From: Brian Candler Date: 2009-10-28T00:13:01+09:00 Subject: Re: how can I do a linux mount in a programmatic way ? Jedrin wrote: > If I do something like system('sudo mount .. ') then I don't really > get any error codes back to see what happened because I just get the > sudo return code here. I think you should get the exit status of the program which sudo ran: $ cat xxx.sh exit 123 $ irb --simple-prompt >> %x{sudo ./xxx.sh} => "" >> $? => # >> $?.exitstatus => 123 >> [Ubuntu Hardy, sudo 1.6.9p10-1ubuntu3.5] Otherwise, I don't know if there's a way to call the mount API directly from ruby. Even if there was, remember that it wouldn't work unless the ruby script itself were running as root. That is: if you need 'sudo' to get root as in your original example, then it's always going to be in a separate process. -- Posted via http://www.ruby-forum.com/.