Created
April 23, 2015 22:42
-
-
Save abrady0/f69de07b79d1b50b0ca0 to your computer and use it in GitHub Desktop.
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
var child = require('child_process'); | |
function runScript() { | |
console.log('runScript'); | |
var args = [__filename, 'spew']; | |
child.execFile( | |
'node', | |
args, | |
function(exitCode, stdout, stderr) { | |
console.log('execFile:done'); | |
if (exitCode) { | |
return console.error('error!!! stderr: '+stderr); | |
} | |
console.log('parsing JSON'); | |
json = JSON.parse(stdout); | |
console.log('done. yaay!'); | |
} | |
); | |
} | |
function spew() { | |
var str = ('0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' | |
+'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' | |
+'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' | |
+'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' | |
+'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' | |
+'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' | |
+'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' | |
+'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' | |
+'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789' | |
+'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'); | |
var res = {}; | |
for (var i = 0; i < 100; i++) { | |
res[i] = i+' '+str; | |
}; | |
console.log(JSON.stringify(res)); | |
} | |
if (!module.parent) { | |
var cmdline = process.argv.join(' '); | |
if (cmdline.indexOf('spew') >= 0) { | |
spew(); | |
process.exit(0); // comment this out to have output succeed. | |
return; | |
} | |
console.log('main:',cmdline) | |
runScript(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment