How to set /low priority switch on windows using exec

48 views
Skip to first unread message

Federico Pici

unread,
Jun 19, 2015, 9:34:16 AM6/19/15
to nod...@googlegroups.com
Hi everybody,
i am trying to execute a java application from my node app.
I am able to execute such application with child_process.exe. In task manager i can see it executes a cmd.exe /s /c <my executable>

Now i need to start such process with low priority (so i should basically add a /low switch to cmd.exe).
How can i achieve such result? I have tryed shell option with no luck.
Under Linux/OSX it is easy because i must only add nice -v 19 before my java -jar command....

Jimb Esser

unread,
Jun 19, 2015, 4:42:25 PM6/19/15
to nod...@googlegroups.com
You do this almost like you would on Linux, just prefix your command with what will spawn it nicely =).  Sounds like you want something like this:
child_process.spawn('cmd.exe', ['/low', '/s', '/c', 'java -jar my.jar'], ...).

If you're already seeing "cmd.exe" in task manager and that's not what you're launching, it sounds like you're using child_process.exec (which launches a shell to interpret your command) instead of .spawn or .execFile (which just launch your command, but require/allow you to specify individual arguments in an array, instead of playing with appropriate quoting and escaping which might get ugly in this case depending on what you're launching =).

Hope this helps!
  Jimb Esser
Reply all
Reply to author
Forward
0 new messages