From: Jon Gunnip Date: 2001-12-11T03:36:27+09:00 Subject: [ruby-talk:28121] Why doesn't Kernel.system throw an exception on error? From the pickaxe book: ------------------------------ system( aCmd [, args]* ) -> true or false Executes aCmd in a subshell, returning true if the command was found and ran successfully, false otherwise ------------------------------ Why doesn't Kernel.system throw an exception instead of returning true or false? Almost every time I use system(cmd), I throw an "or raise 'Error: #{$?}'" on the end of it. I would much prefer to catch a thrown exception. To me, this reliance on return values is: 1) grating visually 2) more Perl-like than Ruby-like 3) more typing One potential problem with having system throw an exception on failure is that certain commands, such as rexec, seem to always return false, and hence, would always throw an exception. Other system-like functions will raise an exception on error. For example, Kernel.exec, File.delete and File.chown all raise an exception if you pass in a file that does not exist. Kernel.system just returns false. Just wondering why this is the case. Thanks, Jon