Added SH fallback
Bryan Roe committed
Apr 23, 2020 at 09:50 UTC
d2822dabbfea7e92271aad74f36e9276e89a4d3c
1 file changed
+10
-1
agents/recoverycore.js
+10
-1
@@ -294,7 +294,16 @@ require('MeshAgent').AddCommandHandler(function (data) {
294
if (this.httprequest.xoptions.cols) { env.COLUMNS = ('' + this.httprequest.xoptions.cols); }
295
}
296
var options = { type: childProcess.SpawnTypes.TERM, env: env };
297
- this.httprequest.process = childProcess.execFile('/bin/bash', ['bash'], options); // Start bash
297
+
298
+ if(require('fs').existsSync('/bin/bash'))
299
+ {
300
+ this.httprequest.process = childProcess.execFile('/bin/bash', ['bash'], options); // Start bash
301
+ }
302
+ else
303
+ {
304
+ this.httprequest.process = childProcess.execFile('/bin/sh', ['sh'], options); // Start sh
305
+ }
306
+
307
// Spaces at the beginning of lines are needed to hide commands from the command history
308
if (process.platform == 'linux') { this.httprequest.process.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); }
309
this.httprequest.process.tunnel = this;