Skip to content

Commit a814362

Browse files
Document the function get_exit_status
1 parent 7a80bd2 commit a814362

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/bin/lpython.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,8 +1658,6 @@ int main(int argc, char *argv[])
16581658
if (0 < err && err < 256) {
16591659
return err;
16601660
} else {
1661-
// https://stackoverflow.com/a/27117435/15913193
1662-
// https://linux.die.net/man/3/system
16631661
return LFortran::get_exit_status(err);
16641662
}
16651663
}

src/lpython/utils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ bool path_exists(std::string path) {
103103
}
104104
}
105105

106+
// Decodes the exit status code of the process (in Unix)
107+
// See `WEXITSTATUS` for more information.
108+
// https://stackoverflow.com/a/27117435/15913193
109+
// https://linux.die.net/man/3/system
106110
int32_t get_exit_status(int32_t err) {
107111
return (((err) >> 8) & 0x000000ff);
108112
}

src/lpython/utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ std::string get_runtime_library_header_dir();
1212
bool is_directory(std::string path);
1313
bool path_exists(std::string path);
1414

15+
// Decodes the exit status code of the process (in Unix)
1516
int32_t get_exit_status(int32_t err);
1617

1718
} // LFortran

0 commit comments

Comments
 (0)