mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge pull request #2605 from johanneskropf/patch-1
use bash as shell for exec command if on linux
This commit is contained in:
commit
708620f929
@ -18,6 +18,7 @@ module.exports = function(RED) {
|
|||||||
"use strict";
|
"use strict";
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
|
var fs = require('fs');
|
||||||
var isUtf8 = require('is-utf8');
|
var isUtf8 = require('is-utf8');
|
||||||
|
|
||||||
function ExecNode(n) {
|
function ExecNode(n) {
|
||||||
@ -30,9 +31,12 @@ module.exports = function(RED) {
|
|||||||
this.timer = Number(n.timer || 0)*1000;
|
this.timer = Number(n.timer || 0)*1000;
|
||||||
this.activeProcesses = {};
|
this.activeProcesses = {};
|
||||||
this.oldrc = (n.oldrc || false).toString();
|
this.oldrc = (n.oldrc || false).toString();
|
||||||
|
this.execOpt = {encoding:'binary', maxBuffer:10000000};
|
||||||
var node = this;
|
var node = this;
|
||||||
|
|
||||||
var cleanup = function(p) {
|
if (process.platform === 'linux' && fs.existsSync('/bin/bash')) { node.execOpt.shell = '/bin/bash'; }
|
||||||
|
|
||||||
|
var cleanup = function(p) {
|
||||||
node.activeProcesses[p].kill();
|
node.activeProcesses[p].kill();
|
||||||
//node.status({fill:"red",shape:"dot",text:"timeout"});
|
//node.status({fill:"red",shape:"dot",text:"timeout"});
|
||||||
//node.error("Exec node timeout");
|
//node.error("Exec node timeout");
|
||||||
@ -127,7 +131,7 @@ module.exports = function(RED) {
|
|||||||
if (node.append.trim() !== "") { cl += " "+node.append; }
|
if (node.append.trim() !== "") { cl += " "+node.append; }
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (RED.settings.verbose) { node.log(cl); }
|
if (RED.settings.verbose) { node.log(cl); }
|
||||||
child = exec(cl, {encoding:'binary', maxBuffer:10000000}, function (error, stdout, stderr) {
|
child = exec(cl, node.execOpt, function (error, stdout, stderr) {
|
||||||
var msg2, msg3;
|
var msg2, msg3;
|
||||||
delete msg.payload;
|
delete msg.payload;
|
||||||
if (stderr) {
|
if (stderr) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user