mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
Fix Commands that Require Quoted Paths (#198)
* fix commands that require quoted paths Several commands did not wrap the path in quotes which caused problems when attempting to store the waveterm installation in a place that had a space in the path. This corrects this in the particular case where the username does not have spaces but the path to the executable does. Note: the case of a user name having spaces has not been tested but likely does not work. * fix logging problem for wavesrv A previous fix replaced the getWaveSrvCmd with getWaveSrvPath. This needs to be getWaveSrvCmd to enable logging. * fix variable name
This commit is contained in:
parent
2c9272e3a7
commit
d1319c0a2c
@ -140,7 +140,7 @@ function getWaveSrvCmd() {
|
||||
let waveSrvPath = getWaveSrvPath();
|
||||
let waveHome = getWaveHomeDir();
|
||||
let logFile = path.join(waveHome, "wavesrv.log");
|
||||
return `${waveSrvPath} >> "${logFile}" 2>&1`;
|
||||
return `"${waveSrvPath}" >> "${logFile}" 2>&1`;
|
||||
}
|
||||
|
||||
function getWaveSrvCwd() {
|
||||
@ -540,8 +540,8 @@ function sendWSSC() {
|
||||
}
|
||||
|
||||
function runWaveSrv() {
|
||||
let pResolve = null;
|
||||
let pReject = null;
|
||||
let pResolve: (value: unknown) => void;
|
||||
let pReject: (reason?: any) => void;
|
||||
let rtnPromise = new Promise((argResolve, argReject) => {
|
||||
pResolve = argResolve;
|
||||
pReject = argReject;
|
||||
@ -551,8 +551,9 @@ function runWaveSrv() {
|
||||
if (isDev) {
|
||||
envCopy[WaveDevVarName] = "1";
|
||||
}
|
||||
console.log("trying to run local server", getWaveSrvPath());
|
||||
let proc = child_process.spawn("bash", ["-c", getWaveSrvCmd()], {
|
||||
let waveSrvCmd = getWaveSrvCmd();
|
||||
console.log("trying to run local server", waveSrvCmd);
|
||||
let proc = child_process.spawn("bash", ["-c", waveSrvCmd], {
|
||||
cwd: getWaveSrvCwd(),
|
||||
env: envCopy,
|
||||
});
|
||||
@ -560,7 +561,7 @@ function runWaveSrv() {
|
||||
console.log("wavesrv exit", e);
|
||||
waveSrvProc = null;
|
||||
sendWSSC();
|
||||
pReject(new Error(sprintf("failed to start local server (%s)", getWaveSrvPath())));
|
||||
pReject(new Error(sprintf("failed to start local server (%s)", waveSrvCmd)));
|
||||
if (waveSrvShouldRestart) {
|
||||
waveSrvShouldRestart = false;
|
||||
this.runWaveSrv();
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/alessio/shellescape"
|
||||
"github.com/armon/circbuf"
|
||||
"github.com/creack/pty"
|
||||
"github.com/google/uuid"
|
||||
@ -66,9 +67,9 @@ func MakeLocalMShellCommandStr(isSudo bool) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
if isSudo {
|
||||
return fmt.Sprintf(`%s; sudo %s --server`, PrintPingPacket, mshellPath), nil
|
||||
return fmt.Sprintf(`%s; sudo %s --server`, PrintPingPacket, shellescape.Quote(mshellPath)), nil
|
||||
} else {
|
||||
return fmt.Sprintf(`%s; %s --server`, PrintPingPacket, mshellPath), nil
|
||||
return fmt.Sprintf(`%s; %s --server`, PrintPingPacket, shellescape.Quote(mshellPath)), nil
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user