1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge branch 'pr_3026' into dev

This commit is contained in:
Nick O'Leary 2021-07-02 09:22:35 +01:00
commit 42992c64ec
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
5 changed files with 19 additions and 3 deletions

View File

@ -40,6 +40,10 @@
<input type="text" id="node-input-timer" style="width:65px;" data-i18n="[placeholder]exec.label.timeoutplace"> <input type="text" id="node-input-timer" style="width:65px;" data-i18n="[placeholder]exec.label.timeoutplace">
<span data-i18n="exec.label.seconds"></span> <span data-i18n="exec.label.seconds"></span>
</div> </div>
<div class="form-row">
<label for="node-input-winHide" style="width: auto !important; padding-right:10px"><i class="fa fa-windows"></i> <span data-i18n="exec.label.winHide"></span></label>
<input type="checkbox" id="node-input-winHide" style="margin-top: 0; display:inline-block; width:auto;">
</div>
<div class="form-row"> <div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label> <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name"> <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
@ -56,6 +60,7 @@
append: {value:""}, append: {value:""},
useSpawn: {value:"false"}, useSpawn: {value:"false"},
timer: {value:""}, timer: {value:""},
winHide: {value:false},
oldrc: {value:false}, oldrc: {value:false},
name: {value:""} name: {value:""}
}, },
@ -92,6 +97,12 @@
}); });
$("#node-input-addpay-cb").trigger("change") $("#node-input-addpay-cb").trigger("change")
if (this.winHide === "true" || this.winHide === true) {
$("#node-input-winHide").prop("checked",true);
} else {
$("#node-input-winHide").prop("checked",false);
}
}, },
oneditsave: function() { oneditsave: function() {
if (!$("#node-input-addpay-cb").prop("checked")) { if (!$("#node-input-addpay-cb").prop("checked")) {

View File

@ -34,7 +34,8 @@ 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:RED.settings.execMaxBufferSize||10000000}; this.execOpt = {encoding:'binary', maxBuffer:RED.settings.execMaxBufferSize||10000000, windowsHide: (n.winHide === true)};
this.spawnOpt = {windowsHide: (n.winHide === true) }
var node = this; var node = this;
if (process.platform === 'linux' && fs.existsSync('/bin/bash')) { node.execOpt.shell = '/bin/bash'; } if (process.platform === 'linux' && fs.existsSync('/bin/bash')) { node.execOpt.shell = '/bin/bash'; }
@ -86,7 +87,7 @@ module.exports = function(RED) {
var cmd = arg.shift(); var cmd = arg.shift();
/* istanbul ignore else */ /* istanbul ignore else */
if (RED.settings.verbose) { node.log(cmd+" ["+arg+"]"); } if (RED.settings.verbose) { node.log(cmd+" ["+arg+"]"); }
child = spawn(cmd,arg); child = spawn(cmd,arg,node.spawnOpt);
node.status({fill:"blue",shape:"dot",text:"pid:"+child.pid}); node.status({fill:"blue",shape:"dot",text:"pid:"+child.pid});
var unknownCommand = (child.pid === undefined); var unknownCommand = (child.pid === undefined);
if (node.timer !== 0) { if (node.timer !== 0) {

View File

@ -73,6 +73,7 @@
<p>The returned <code>payload</code> is usually a <i>string</i>, unless non-UTF8 characters are detected, in which <p>The returned <code>payload</code> is usually a <i>string</i>, unless non-UTF8 characters are detected, in which
case it is a <i>buffer</i>.</p> case it is a <i>buffer</i>.</p>
<p>The node&apos;s status icon and PID will be visible while the node is active. Changes to this can be read by the <code>Status</code> node.</p> <p>The node&apos;s status icon and PID will be visible while the node is active. Changes to this can be read by the <code>Status</code> node.</p>
<p>The <code>Hide console</code> option will hide the process console normally shown on Windows systems.</p>
<h4>Killing processes</h4> <h4>Killing processes</h4>
<p>Sending <code>msg.kill</code> will kill a single active process. <code>msg.kill</code> should be a string containing <p>Sending <code>msg.kill</code> will kill a single active process. <code>msg.kill</code> should be a string containing
the type of signal to be sent, for example, <code>SIGINT</code>, <code>SIGQUIT</code> or <code>SIGHUP</code>. the type of signal to be sent, for example, <code>SIGINT</code>, <code>SIGQUIT</code> or <code>SIGHUP</code>.

View File

@ -198,7 +198,8 @@
"seconds": "seconds", "seconds": "seconds",
"stdout": "stdout", "stdout": "stdout",
"stderr": "stderr", "stderr": "stderr",
"retcode": "return code" "retcode": "return code",
"winHide": "Hide console"
}, },
"placeholder": { "placeholder": {
"extraparams": "extra input parameters" "extraparams": "extra input parameters"

View File

@ -44,6 +44,8 @@ describe('exec node', function() {
n1.should.have.property("addpay","payload"); n1.should.have.property("addpay","payload");
n1.should.have.property("timer",0); n1.should.have.property("timer",0);
n1.should.have.property("oldrc","false"); n1.should.have.property("oldrc","false");
n1.should.have.property("execOpt", {encoding:'binary', maxBuffer:10000000, windowsHide: false});
n1.should.have.property("spawnOpt", {windowsHide:false});
done(); done();
}); });
}); });