node-windows
node-windows copied to clipboard
Child process error
Hi,
We have made a node-windows
service that have a main script that run a child process command to open an .exe like this
var cp = require("child_process");
cp.exec("C:\\Users\\test\\Desktop\\file.exe", function(error, stdout) {
});
If we run node main.js
it's work like expected, but if we run service it throw error
Command failed
I don't know why.. Any idea?
First thoughts are permissions. Try changing the user running the service to one that has permissions to that directory.
via Newton Mail [https://cloudmagic.com/k/d/mailapp?ct=pi&cv=9.4.52&pv=10.2.1&source=email_footer_2] On Thu, Mar 2, 2017 at 3:34 PM, Daviz [email protected] wrote: Hi,
We have made a node-windows service that have a main script that run a child process command to open an .exe like this
var cp = require("child_process"); cp.exec("C:\Users\test\Desktop\file.exe", function(error, stdout) { });
If we run node main.js it's work like expected, but if we run service it throw error Command failed I don't know why.. Any idea?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [https://github.com/coreybutler/node-windows/issues/163] , or mute the thread [https://github.com/notifications/unsubscribe-auth/ABIType7hfoGWRwRFxgfbexEXvdJ98wAks5rhyfGgaJpZM4MRflw] .
Thanks for ask me, but I've try a lot also with elevate and nothing change. The user is administrator and file doesn't have UAC...
Remember that running the node-windows service as an elevated user doesn't mean the child process is running as an elevated admin user. You have to explicitly elevate permissions for the child process... it's not enough to just run the parent process as an elevated admin. This means you may need to change the command in in cp.exec
.
Also, this isn't an issue.... it's a question. This would be better asked on StackOverflow.
We have try to run with elevate
and write user administrator to service in code.
If we check the options Interact with desktop
it's open a dialog to confirm that seems to working but SEEM...
If we not confirm dialog it's run process but without open gui I don't know why...
Edit: The process start it's ok but interact with desktop not work!! Gui are not displayed... Only we choose another window in Windows...
Edit2: We have try to create a .bat
in that run our .exe
but also not start file and it's get no error...
Edit3: My issue seems like to https://github.com/coreybutler/node-windows/issues/138 ..
Edit4: It's seems that process go in Background mode!!!
Hello @furyscript, I seem to be having the same problem, when i run it through windows service the task goes in background... Any idea how to solve it and make it run in foreground?