Skip to content

Instantly share code, notes, and snippets.

@aoi0308
Created June 28, 2012 03:33
Show Gist options
  • Select an option

  • Save aoi0308/3008774 to your computer and use it in GitHub Desktop.

Select an option

Save aoi0308/3008774 to your computer and use it in GitHub Desktop.
Nodeの裏でJavaのプログラムを起動して標準入出力をパイプするプログラム
var util = require('util')
,spawn = require('child_process').spawn
,java = spawn('java', ['Sample']);
process.stdin.resume();
java.stdin.on('close', function() {
process.exit(0);
});
util.pump(process.stdin, java.stdin);
util.pump(java.stdout, process.stdout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment