On Wed, Dec 3, 2008 at 9:42 PM, Pea, Botp <botp / delmonte-phil.com> wrote:
> From: Kyle Schmitt [mailto:kyleaschmitt / gmail.com]
> # I know it should be streightforward, but I'm not finding the
> # docs anywhere...
>
> what is kernel#system?
>
> botp@botp-desktop:~$ qri kernel#system
> ------------------------------------------------ Kernel#system
>     system(cmd [, arg, ...])    => true or false
> -------------------------------------------------
> Executes cmd in a subshell, returning true if the command was
> found and ran successfully, false otherwise. An error status is
> available in $?. The arguments are processed in the same way as
> for Kernel::exec.
>
>        system("echo *")
>        system("echo", "*")
>
>
> # How does one go about rescuing a failed shell command?
> # like in the instance it fails, or the command isn't found?
>
> basically, you'll just have to ask it, like
>
>  rescue_command_here unless system(my_shell_command)
>
> lastly, you'll have to test it (because i just type this answers on my inbox w/o testing :)
>

Would work, but I can't use system because I need to capture and
process the output of the shell commands.

Thanks though.