[Chicago-talk] return value of failed system call

Randal L. Schwartz merlyn at stonehenge.com
Mon Aug 1 14:43:38 PDT 2011


>>>>> "Richard" == Richard Reina <richard at rushlogistics.com> writes:

Richard> I am writing a short script that will install several packages
Richard> and report if any fail.  The problem I am having is that
Richard> whether the install fails of succeeds I am getting "0" as a
Richard> result.  I am doing the follwing: my $result = system("yum -y
Richard> install NotA_real_package.hah-ha");

Richard> and $result comes back as "0" just as it does when I
Richard> successfully install a package. I am using CentOS.

It's up to the authors of yum to write code the way you want it.  If
they don't return a non-zero for a failed install, you'll have to parse
the error messages instead.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion


More information about the Chicago-talk mailing list