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

Add flash of status to exec node

This commit is contained in:
Dave C-J 2014-06-07 22:00:03 +01:00
parent 346ca21803
commit c10ed13322

View File

@ -15,6 +15,7 @@
**/ **/
module.exports = function(RED) { module.exports = function(RED) {
"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;
@ -27,7 +28,7 @@ module.exports = function(RED) {
var node = this; var node = this;
this.on("input", function(msg) { this.on("input", function(msg) {
if (msg != null) { if (msg != null) {
node.status({fill:"blue",shape:"dot"});
if (this.useSpawn == true) { if (this.useSpawn == true) {
// make the extra args into an array // make the extra args into an array
// then prepend with the msg.payload // then prepend with the msg.payload
@ -51,6 +52,7 @@ module.exports = function(RED) {
ex.on('close', function (code) { ex.on('close', function (code) {
//console.log('[exec] result: ' + code); //console.log('[exec] result: ' + code);
msg.payload = code; msg.payload = code;
node.status({});
node.send([null,null,msg]); node.send([null,null,msg]);
}); });
} }
@ -69,6 +71,7 @@ module.exports = function(RED) {
var msg3 = {payload:error}; var msg3 = {payload:error};
//console.log('[exec] error: ' + error); //console.log('[exec] error: ' + error);
} }
node.status({});
node.send([msg,msg2,msg3]); node.send([msg,msg2,msg3]);
}); });
} }