Last active
August 29, 2015 14:28
-
-
Save afucher/14da6a7816eaf91a8ded to your computer and use it in GitHub Desktop.
Echo from bat file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var childProcess = require("child_process"); | |
var oldSpawn = childProcess.spawn; | |
function mySpawn() { | |
console.log('spawn called'); | |
console.log(arguments); | |
var result = oldSpawn.apply(this, arguments); | |
return result; | |
} | |
childProcess.spawn = mySpawn; | |
})(); | |
var spawn = require('child_process').spawn; | |
var ls = spawn(__dirname + '\\teste.bat',[],{stdio:'inherit'}); | |
/* | |
ls.stdout.on('data', function (data) { | |
console.log('stdout: ' + data); | |
}); | |
ls.stderr.on('data', function (data) { | |
console.log('stderr: ' + data); | |
}); | |
*/ | |
ls.on('exit', function (code) { | |
console.log('child process exited with code ' + code); | |
}); | |
ls.on('uncaughtException', function(err) { | |
console.log('Caught exception: ' + err); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
echo aparece alguma coisa! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment