Created
April 11, 2015 03:20
-
-
Save duyet/34325cf4b8789efdc3cb to your computer and use it in GitHub Desktop.
Exec Nodejs on Nodejs Application.
This file contains hidden or 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
var spawn = require('child_process').spawn; | |
var prc = spawn('java', ['-jar', '-Xmx512M', '-Dfile.encoding=utf8', 'script/importlistings.jar']); | |
//noinspection JSUnresolvedFunction | |
prc.stdout.setEncoding('utf8'); | |
prc.stdout.on('data', function (data) { | |
var str = data.toString() | |
var lines = str.split(/(\r?\n)/g); | |
console.log(lines.join("")); | |
}); | |
prc.on('close', function (code) { | |
console.log('process exit code ' + code); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment