Fix for #3026, when terminal command is set to an empty string.

Ylian Saint-Hilaire committed Aug 22, 2021 at 12:06 UTC 41f70d52dcf7553777054a5a4f50a973cd0de3ab
1 file changed +6 -4
agents/meshcore.js
+6 -4
@@ -1986,15 +1986,17 @@ function onTunnelData(data) {
1986 else if (bash) {
1987 var p = childProcess.execFile(bash, ['bash'], options); // Start bash
1988 // Spaces at the beginning of lines are needed to hide commands from the command history
1989 - if ((obj.serverInfo.termlaunchcommand != null) && (typeof obj.serverInfo.termlaunchcommand[process.platform] == 'string')) { p.stdin.write(obj.serverInfo.termlaunchcommand[process.platform]); }
1990 - else if (process.platform == 'linux') { p.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); }
1989 + if ((obj.serverInfo.termlaunchcommand != null) && (typeof obj.serverInfo.termlaunchcommand[process.platform] == 'string')) {
1990 + if (obj.serverInfo.termlaunchcommand[process.platform] != "") { p.stdin.write(obj.serverInfo.termlaunchcommand[process.platform]); }
1991 + } else if (process.platform == 'linux') { p.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); }
1992 this.httprequest.connectionPromise._res(p);
1993 }
1994 else if (sh) {
1995 var p = childProcess.execFile(sh, ['sh'], options); // Start sh
1996 // Spaces at the beginning of lines are needed to hide commands from the command history
1996 - if ((obj.serverInfo.termlaunchcommand != null) && (typeof obj.serverInfo.termlaunchcommand[process.platform] == 'string')) { p.stdin.write(obj.serverInfo.termlaunchcommand[process.platform]); }
1997 - else if (process.platform == 'linux') { p.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); }
1997 + if ((obj.serverInfo.termlaunchcommand != null) && (typeof obj.serverInfo.termlaunchcommand[process.platform] == 'string')) {
1998 + if (obj.serverInfo.termlaunchcommand[process.platform] != "") { p.stdin.write(obj.serverInfo.termlaunchcommand[process.platform]); }
1999 + } else if (process.platform == 'linux') { p.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); }
2000 this.httprequest.connectionPromise._res(p);
2001 }
2002 else {