Does exit code status with zero value always mean successfully run in Perl?
Asked Answered
I

2

5

I have a Perl script that will execute three applications. All of it have different exit code status.

First application exit code status is 1. The application exited normally without any problem. (Successful)

Second application exit code status is 99. Still, the application exited normally without any problem. (Successful)

Lastly, the third application exit code status is 0. The same with the first and second, the application exited normally without any problem. (Successful)

Note: Already shift the exit code status 8 bits to right.

Question is, does the exit code status always return to 0 if successfully run?

Please no harsh comment, I just confused. Please advice.

Ingratiate answered 23/3, 2012 at 6:48 Comment(0)
A
8

The return status is chosen by the child process. It is conventionally zero for successful operation but there is nothing to enforce that convention.

It is also possible for processes to return informational return statuses which indicate different forms of success. For instance, a program that modified all files in a directory may return a non-zero value to say that there were no files to modify.

You should check the documentation of the applications to see if anything is mentioned about what values may be returned. If you can find nothing then you should decide empirically what values indicate success.

Anaesthesia answered 23/3, 2012 at 7:6 Comment(0)
B
4

Most operating system environments suggest and provide support for zero as a successful exit code, and other values indicating some sort of status: whether ordinary or exceptional is documented individually for each program.

Even simplistic MSDOS provides good support for a batch file to react to a certain errorlevel and do something different.

One environment which has strong default reactions to a non-zero return status is the VMS/OpenVMS operating system family. If your application(s) might run there, please follow the standard.

Bullnose answered 23/3, 2012 at 7:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.