From 4569bfb5c4425417c3260b7ea60a297d7917a101 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Thu, 23 Apr 2020 09:50:55 -0700 Subject: [PATCH] Added SH fallback --- agents/recoverycore.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/agents/recoverycore.js b/agents/recoverycore.js index 0ff635a6..74efcd8b 100644 --- a/agents/recoverycore.js +++ b/agents/recoverycore.js @@ -294,7 +294,16 @@ require('MeshAgent').AddCommandHandler(function (data) { if (this.httprequest.xoptions.cols) { env.COLUMNS = ('' + this.httprequest.xoptions.cols); } } var options = { type: childProcess.SpawnTypes.TERM, env: env }; - this.httprequest.process = childProcess.execFile('/bin/bash', ['bash'], options); // Start bash + + if(require('fs').existsSync('/bin/bash')) + { + this.httprequest.process = childProcess.execFile('/bin/bash', ['bash'], options); // Start bash + } + else + { + this.httprequest.process = childProcess.execFile('/bin/sh', ['sh'], options); // Start sh + } + // Spaces at the beginning of lines are needed to hide commands from the command history if (process.platform == 'linux') { this.httprequest.process.stdin.write(' alias ls=\'ls --color=auto\';clear\n'); } this.httprequest.process.tunnel = this;