[% setvar title system() should return useful values %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/

TITLE

system() should return useful values

VERSION

  Maintainer: Nathan Torkington <gnat@frii.com>
  Date: 13 Sep 2000
  Mailing List: perl6-language@perl.org
  Number: 221
  Version: 1
  Status: Developing

ABSTRACT

system() should return true if the program exited normally, false otherwise.

DESCRIPTION

In perl5, system() returns the wait status of the program: 0 if it succeeded, a positive number if it failed. This means you can't test for failure with "|| die" as you can with so many other Perl functions.

I propose changing it so that system() returns false on failure and true on success.

It would no longer return the exit status of the program, which would need to be collected through $? or its perl6 replacement.

IMPLEMENTATION

Simple change to the pp_code for system().

The perl526 translator would replace system() with:

  do { system(...); $? }

REFERENCES

perlfunc manpage for description of system()

perlvar manpage for description of $?