>From a usability perspective, the ideal would be that the user is prompted for elevated privileges only when he takes an action within my node program that actually requires those privileges. The second best option would be if the user was prompted for elevated privileges when they first start the node program. The least ideal is if the user isn't prompted at all, that it would be up to the user to always remember to start the program by right-click run as administrator. This is the least ideal because it puts to the burden on the user to remember to always start the program in a non-typical way.
So, to get back to my original question, right now if I try to spawn a child process where the program being spawned requires elevated privileges (example code in my original message), the current behavior is that the user is not prompted for those privileges, and instead the node program crashes with an error. How can I get my node program to request those privileges instead of just dying? On Tuesday, December 31, 2013 11:27:48 AM UTC-8, Alex Kocharin wrote: > > > Why not? > > If user is about to run a potentially dangerous program (as all privileged > programs are), he must confirm that he is intended to do so. > > > 31.12.2013, 22:34, "[email protected] <javascript:>" < > [email protected] <javascript:>>: > > Can I do that programically? I'd rather not require that users must always > right-click "run as administrator". > > > On Tuesday, December 31, 2013 9:59:56 AM UTC-8, Alex Kocharin wrote: > > > What about starting node.js itself with elevated privileges? (and possibly > dropping them later if they aren't needed) > > > 31.12.2013, 13:45, "[email protected]" <[email protected]>: > > I need to launch an external program, but I'm hitting a roadblock because > that external program requires elevated privileges. Normally I would just > do this: > > require('child_process').spawn('C:\\Users\\me\\AppData\\Local\\Temp\\ > 1131128-16232-bid56z__some_installer.exe'); > > But this throws an error because the external program requires elevated > privileges. Some have suggested that I use the "runas" command, but I > haven't had much success yet. No error is thrown, but the external program > doesn't run either. > > require('child_process').spawn('runas', > ['/user:my_machine_name\\administrator', > 'C:\\Users\\me\\AppData\\Local\\Temp\\1131130-18300-1 > wol3cr__some_installer.exe']); > > I've also been trying the node-window module's "elevate" method. It seems > to use batch and VB scripts to do its magic, and it comes very close to > solving my problem. The issue with this solution is that the child > process's "close" and "exit" events seem to trigger immediately, and I lose > all communication with the child process. I presume this is because the > child process is aware of only the batch cmd or vbs and not my actual > external program. > > For the moment, I'm at a dead end. I'm very much hoping someone has an > ingenious idea. > > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
