jfromaniello / winser

Run a node.js application as a window service using nssm.
270 stars 47 forks source link

Can not use exec #35

Open kodypeterson opened 10 years ago

kodypeterson commented 10 years ago

I am trying to use the following. It works when ran with "node app.js" but not from within the service:

var exec = require('child_process').execFile; exec("C:\scripts\" + req.params.script + ".exe", function(error, stdout, stderr){ console.log(arguments); });

Any ideas?

jmorrisIII commented 9 years ago

Did you ever figure this out?

kodypeterson commented 9 years ago

Nope, still a problem

jfromaniello commented 9 years ago

Sorry for the delay, I missed the notification.

I don't know what req.params.script is, and what's the error you get.

Maybe you should write the logs to a file, checkout winston or bunyan

jmorrisIII commented 9 years ago

I think there is a problem with running an executable from a windows service after XP.

kodypeterson commented 9 years ago

Yeah, so req.params.script is the location to the executable. So lets just say this is the code failing:

var exec = require('child_process').execFile; exec("C:\scripts\test.exe", function(error, stdout, stderr){ console.log(arguments); });

deliverymanager commented 9 years ago

Did you manage to figure this problem of the exec command not working to a .exe file?

JBarna commented 8 years ago

I found a reason for this problem at this link. Turns our you can't create processes from windows services anymore.