add don't add payload to exec node

to close #578
This commit is contained in:
dceejay
2015-03-11 17:43:42 +00:00
parent f6203fe60a
commit 1f8c6f87c9
2 changed files with 26 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
<!--
Copyright 2013 IBM Corp.
Copyright 2013,2015 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -20,8 +20,13 @@
<input type="text" id="node-input-command" placeholder="command">
</div>
<div class="form-row">
<label for="node-input-append"><i class="fa fa-list"></i> Append</label>
<input type="text" id="node-input-append" placeholder="extra input">
<label><i class="fa fa-plus"></i> Append</label>
<input type="checkbox" id="node-input-addpay" style="display: inline-block; width: auto; vertical-align: top;">
&nbsp;msg.payload
</div>
<div class="form-row">
<label for="node-input-append"> </label>
<input type="text" id="node-input-append" placeholder="extra input parameters">
</div>
<div class="form-row">
<label>&nbsp;</label>
@@ -32,7 +37,7 @@
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">Tip: <i>spawn</i> expects only one command word - and appended args to be comma separated.</div>
<div class="form-tips" id="spawnTip">Tip: <i>spawn</i> expects only one command word - and appended args to be comma separated.</div>
</script>
<script type="text/x-red" data-help-name="exec">
@@ -40,7 +45,7 @@
<p>Provides 3 outputs... stdout, stderr, and return code.</p>
<p>By default uses exec() which calls the command, blocks while waiting for completion, and then returns the complete result in one go, along with any errors.</p>
<p>Optionally can use spawn() instead, which returns output from stdout and stderr as the command runs (ie one line at a time). On completion it then returns a return code (on the 3rd output).</p>
<p>Spawn only expect one command word, with all extra parameters to be comma separated and passed as the append.</p>
<p>Spawn only expects one command word, with all extra parameters to be comma separated and passed as the append.</p>
<p>The optional append gets added to the command after the <b>msg.payload</b> - so you can do things like pipe the result to another command.</p>
<p>If stdout is binary a <i>buffer</i> is returned - otherwise returns a <i>string</i>.</p>
</script>
@@ -51,6 +56,7 @@
color:"darksalmon",
defaults: {
command: {value:"",required:true},
addpay: {value:true},
append: {value:""},
useSpawn: {value:""},
name: {value:""}
@@ -64,6 +70,15 @@
},
labelStyle: function() {
return this.name?"node_label_italic":"";
},
oneditprepare: function() {
$("#node-input-useSpawn").on("change",function() {
if ($("#node-input-useSpawn").is(':checked')) {
$("#spawnTip").show();
} else {
$("#spawnTip").hide();
}
});
}
});
</script>