(E-Mail Removed) writes:
> I'm using Perl 5.16 on mac 10.9.1. I'm trying to get Perl to output the correct error message when I run a shell process and that process fails. I have this ...
>
> system("$jbossHome/bin/jboss-cli.sh", "--file=$file");
> if ( $? != 0 )
> {
> die"Failed to deploy $downloadedFile: $!\n";
> }
>
> However, what Perl reports is "Failed to deploy /tmp/my.war:
> Inappropriate ioctl for device"
$! is the Perl-equivalent of errno and it is set when an operation
performed via the C library fails, usually, a system call. But no system
calls made by your program failed during system, the program executed in
this way 'failed' to accomplish something, hence, you got a non-zero
exit status back. But (for obvious reasons), the system cannot provide
error messages arbitrary "application failures". The value in $! is just
one which happened to have been left in there when the last system call
failed (which was very likely an expected failure during the course of
system and hence, not reported to your code).
> I'm using Perl 5.16 on mac 10.9.1. I'm trying to get Perl to output the correct error message when I run a shell process and that process fails. I have this ...
>
> system("$jbossHome/bin/jboss-cli.sh", "--file=$file");
> if ( $? != 0 )
> {
> die"Failed to deploy $downloadedFile: $!\n";
> }
>
> However, what Perl reports is "Failed to deploy /tmp/my.war:
> Inappropriate ioctl for device"
$! is the Perl-equivalent of errno and it is set when an operation
performed via the C library fails, usually, a system call. But no system
calls made by your program failed during system, the program executed in
this way 'failed' to accomplish something, hence, you got a non-zero
exit status back. But (for obvious reasons), the system cannot provide
error messages arbitrary "application failures". The value in $! is just
one which happened to have been left in there when the last system call
failed (which was very likely an expected failure during the course of
system and hence, not reported to your code).
Aucun commentaire:
Enregistrer un commentaire