I use a variation of this...
http://developer.apple.com/mac/library/qa/qa2001/qa1134.html
On Sep 14, 2009, at 5:59 PM, PCWiz wrote:
How would I shut down and restart the computer using Objective-C code?
Thanks
___
Cocoa-dev mailing list
How would I shut down and restart the computer using Objective-C code?
Thanks
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at
A call to the system command, like:
system (sudo /sbin/shutdown -h now');
You'd have to make sure your user is authenticated to use shutdown via sudo ...
I'm not sure if there's a cleaner way specific to OS X. The above should work
a reasonable portion of UNIX and UNIX-type systems.
On Sep 14, 2009, at 6:14 PM, vinai for_use...@yahoo.com wrote:
A call to the system command, like:
system (sudo /sbin/shutdown -h now');
Nononono. This is entirely the wrong way to do this. ESPECIALLY for
privileged operations.
Read the section Application Responsibilities in Logout
On Sep 14, 2009, at 6:59 PM, PCWiz wrote:
How would I shut down and restart the computer using Objective-C code?
Don't use the /sbin/shutdown command as previously recommended. That
command will not give users the chance to save their work before the
reboot/shutdown. Instead, send events