On Nov 20, 2007, at 1:29 AM, Yukihiro Matsumoto wrote:

> Hi,
>
> In message "Re: Change in system() behaviour"
>     on Tue, 20 Nov 2007 04:07:55 +0900, Dave Thomas  
> <dave / pragprog.com> writes:
>
> |In 1.8,  system("badcmd")  returned false.
> |In 1.9, it raises Errno::ENOENT
> |
> |Is this an intended change?
>
> Yes.  The command execution has tree states:
>
>   * command execution failed (non zero exit status)
>   * command execution succeeded (zero exit status)
>   * command not found
>
> The new "system" gives true/false/exception respectively.  We thought
> these three should be distinguished.  Returning nil for "not found"
> in [ruby-core:13715] might be an idea.

I can see the reason for distinguishing the three, but I think that  
using an exception might be a bit too much: most of the time, you  
simply want to write

    if system(...)

As a user of the API, your first priority is knowing whether it  
worked. You _might_ then be interested in knowing why if it failed.  
I'd definitely support the nil/false approach over using an exception.


Dave