Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use bash as shell for exec command if on linux #2605

Merged
merged 3 commits into from Jun 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -18,6 +18,7 @@ module.exports = function(RED) {
"use strict";
var spawn = require('child_process').spawn;
var exec = require('child_process').exec;
var fs = require('fs');
var isUtf8 = require('is-utf8');

function ExecNode(n) {
Expand Down Expand Up @@ -122,12 +123,14 @@ module.exports = function(RED) {
});
}
else {
var execOpt = {encoding:'binary', maxBuffer:10000000};
if (process.platform === 'linux' && fs.existsSync('/bin/bash')) { execOpt.shell = '/bin/bash'; }
dceejay marked this conversation as resolved.
Show resolved Hide resolved
var cl = node.cmd;
if ((node.addpay === true) && msg.hasOwnProperty("payload")) { cl += " "+msg.payload; }
if (node.append.trim() !== "") { cl += " "+node.append; }
/* istanbul ignore else */
if (RED.settings.verbose) { node.log(cl); }
child = exec(cl, {encoding:'binary', maxBuffer:10000000}, function (error, stdout, stderr) {
child = exec(cl, execOpt, function (error, stdout, stderr) {
var msg2, msg3;
delete msg.payload;
if (stderr) {
Expand Down