mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Let exec node (spawn) handle commands with spaces in path
This commit is contained in:
parent
555f96cfaf
commit
08b11addec
@ -53,7 +53,7 @@
|
|||||||
(on the 3rd output).</p>
|
(on the 3rd output).</p>
|
||||||
<p>The optional append gets added to the command after <code>msg.payload</code> - so you can do
|
<p>The optional append gets added to the command after <code>msg.payload</code> - so you can do
|
||||||
things like pipe the result to another command.</p>
|
things like pipe the result to another command.</p>
|
||||||
<p>Parameters with spaces should be enclosed in quotes - <i>"This is a single parameter"</i></p>
|
<p>Commands or parameters with spaces should be enclosed in quotes - <i>"This is a single parameter"</i></p>
|
||||||
<p>If stdout is binary a <i>buffer</i> is returned - otherwise returns a <i>string</i>.</p>
|
<p>If stdout is binary a <i>buffer</i> is returned - otherwise returns a <i>string</i>.</p>
|
||||||
<p>The blue status icon will be visible while the node is active.</p>
|
<p>The blue status icon will be visible while the node is active.</p>
|
||||||
<p>If running a Python app you may need to use the <code>-u</code> parameter to stop the output being buffered.</p>
|
<p>If running a Python app you may need to use the <code>-u</code> parameter to stop the output being buffered.</p>
|
||||||
|
@ -49,6 +49,7 @@ module.exports = function(RED) {
|
|||||||
// slice whole line by spaces (trying to honour quotes);
|
// slice whole line by spaces (trying to honour quotes);
|
||||||
arg = arg.match(/(?:[^\s"]+|"[^"]*")+/g);
|
arg = arg.match(/(?:[^\s"]+|"[^"]*")+/g);
|
||||||
var cmd = arg.shift();
|
var cmd = arg.shift();
|
||||||
|
if (/^".*"$/.test(cmd)) { cmd = cmd.slice(1,-1); }
|
||||||
/* 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);
|
||||||
|
Loading…
Reference in New Issue
Block a user