1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/nodes/core/core/75-exec.html
Scott Yoshizawa 2fe859b111 NLS Core nodes
NLS exec node

NLS function/temple/delay nodes

NLS function/template/delay/trigger/comment nodes

NLS io nodes (mqtt/httpin/websocket/watch/serial)

NLS messages.json for tcpin

NLS io nodes (tcpin & udp half)

NLS io nodes (udp)

NLS logic nodes (switch/change)

NLS logic (range) and parsers (csv&html) nodes

NLS parser nodes (json/xml)

NLS test case update for logic/parsers

NLS analysis and hardware nodes

NLS storage nodes (file/redisout/mongodb) and test

NLS storage node (tail)

NLS social nodes (feedparse/email/irc)

NLS socal node (twitter half change)

NLS social node (twitter) and core node (unknown)
2015-07-02 10:46:57 +01:00

85 lines
3.8 KiB
HTML

<!--
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.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="exec">
<div class="form-row">
<label for="node-input-command"><i class="fa fa-file"></i> <span data-i18n="exec.command"></span></label>
<input type="text" id="node-input-command" data-i18n="[placeholder]exec.commandph">
</div>
<div class="form-row">
<label><i class="fa fa-plus"></i> <span data-i18n="exec.append"></span></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" data-i18n="[placeholder]exec.extraparams">
</div>
<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-useSpawn" placeholder="spawn" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-useSpawn" style="width: 70%;"><span data-i18n="exec.spawn"></span></label>
</div>
<div class="form-row">
<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.nameph">
</div>
<div class="form-tips" id="spawnTip"><span data-i18n="[html]exec.tip"></span></div>
</script>
<script type="text/x-red" data-help-name="exec">
<p>Calls out to a system command.<br/></p>
<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 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>
<script type="text/javascript">
RED.nodes.registerType('exec',{
category: 'advanced-function',
color:"darksalmon",
defaults: {
command: {value:"",required:true},
addpay: {value:true},
append: {value:""},
useSpawn: {value:""},
name: {value:""}
},
inputs:1,
outputs:3,
icon: "arrow-in.png",
align: "right",
label: function() {
return this.name||this.command;
},
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>