chore: simplify command to run waveshell remotely

This change removes the extra check for a directory and just tries to
run the command instead. It pipes the usual error to null and prints an
init packet instead.
This commit is contained in:
Sylvia Crowe 2024-03-01 00:44:18 -08:00
parent 5dfb8a816f
commit 4e5eea51b6

View File

@ -74,14 +74,7 @@ const PrintPingPacket = `printf "\n##N{\"type\": \"ping\"}\n"`
const MShellServerCommandFmt = ` const MShellServerCommandFmt = `
PATH=$PATH:~/.mshell; PATH=$PATH:~/.mshell;
which mshell-[%VERSION%] > /dev/null; mshell-[%VERSION%] --server 2> /dev/null || printf "\n##N{\"type\": \"init\", \"notfound\": true, \"uname\": \"%s | %s\"}\n" "$(uname -s)" "$(uname -m)"
if [[ "$?" -ne 0 ]]
then
printf "\n##N{\"type\": \"init\", \"notfound\": true, \"uname\": \"%s | %s\"}\n" "$(uname -s)" "$(uname -m)"
else
[%PINGPACKET%]
mshell-[%VERSION%] --server
fi
` `
func MakeLocalMShellCommandStr(isSudo bool) (string, error) { func MakeLocalMShellCommandStr(isSudo bool) (string, error) {