Node.js child process with a very long argument

Viewed 1871

I use the Node.js child_process to spawn a jar file, like so:

var child = require('child_process').spawn('java', ['-Xmx1024m', '-jar', 'myJarFile.jar', argString]);

While this works for short string values of argString, I get the following error while using a really long string as the argument:

Error: spawn ENAMETOOLONG
    at exports._errnoException (util.js:1018:11)
    at ChildProcess.spawn (internal/child_process.js:319:11)
    at Object.exports.spawn (child_process.js:378:9)
    ...

Is there a way to fix this issue?

0 Answers
Related