How to run an external program in node.js on windows?

I am creating a process to create an automated web application with node.js in windows. I am trying to run our code through the java closure program of Google. I read the documentation on child_process in the node docs. He mentions that he is not yet working in the windows. Is there a package or work for this?

Here is the code that is trying to run.

var _exec = require('child_process').exec; _exec( 'java ' + '-jar '+ COMPILER_JAR +' --js '+ srcPath +' --js_output_file '+ distPath, function(e){ echo( "google closure done...."); echo( e ); } ); 
+7
source share
1 answer

I have a web server application for managing build queues on Windows XP, and I used it to run batch files or executables without any additional packages.

I would check the error parameter on the callback and stderr, as this can help you find the reason why it does not work.

My sample solution is from my server, which I hope will help:

 var theJobType = 'FOO'; var exec = require('child_process').exec; var child = exec('Test.exe ' + theJobType, function( error, stdout, stderr) { if ( error != null ) { console.log(stderr); // error handling & exit } // normal }); 
+13
source

All Articles