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 waveSrvPath = getWaveSrvPath();
|
||||||
let waveHome = getWaveHomeDir();
|
let waveHome = getWaveHomeDir();
|
||||||
let logFile = path.join(waveHome, "wavesrv.log");
|
let logFile = path.join(waveHome, "wavesrv.log");
|
||||||
return `${waveSrvPath} >> "${logFile}" 2>&1`;
|
return `"${waveSrvPath}" >> "${logFile}" 2>&1`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWaveSrvCwd() {
|
function getWaveSrvCwd() {
|
||||||
@ -540,8 +540,8 @@ function sendWSSC() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runWaveSrv() {
|
function runWaveSrv() {
|
||||||
let pResolve = null;
|
let pResolve: (value: unknown) => void;
|
||||||
let pReject = null;
|
let pReject: (reason?: any) => void;
|
||||||
let rtnPromise = new Promise((argResolve, argReject) => {
|
let rtnPromise = new Promise((argResolve, argReject) => {
|
||||||
pResolve = argResolve;
|
pResolve = argResolve;
|
||||||
pReject = argReject;
|
pReject = argReject;
|
||||||
@ -551,8 +551,9 @@ function runWaveSrv() {
|
|||||||
if (isDev) {
|
if (isDev) {
|
||||||
envCopy[WaveDevVarName] = "1";
|
envCopy[WaveDevVarName] = "1";
|
||||||
}
|
}
|
||||||
console.log("trying to run local server", getWaveSrvPath());
|
let waveSrvCmd = getWaveSrvCmd();
|
||||||
let proc = child_process.spawn("bash", ["-c", getWaveSrvCmd()], {
|
console.log("trying to run local server", waveSrvCmd);
|
||||||
|
let proc = child_process.spawn("bash", ["-c", waveSrvCmd], {
|
||||||
cwd: getWaveSrvCwd(),
|
cwd: getWaveSrvCwd(),
|
||||||
env: envCopy,
|
env: envCopy,
|
||||||
});
|
});
|
||||||
@ -560,7 +561,7 @@ function runWaveSrv() {
|
|||||||
console.log("wavesrv exit", e);
|
console.log("wavesrv exit", e);
|
||||||
waveSrvProc = null;
|
waveSrvProc = null;
|
||||||
sendWSSC();
|
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) {
|
if (waveSrvShouldRestart) {
|
||||||
waveSrvShouldRestart = false;
|
waveSrvShouldRestart = false;
|
||||||
this.runWaveSrv();
|
this.runWaveSrv();
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/alessio/shellescape"
|
||||||
"github.com/armon/circbuf"
|
"github.com/armon/circbuf"
|
||||||
"github.com/creack/pty"
|
"github.com/creack/pty"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@ -66,9 +67,9 @@ func MakeLocalMShellCommandStr(isSudo bool) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if isSudo {
|
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 {
|
} 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