Skip to content

Commit dff677d

Browse files
committed
cmdstat will set to 3 when error then set to specific value
1 parent 633b0c4 commit dff677d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

flang/runtime/execute.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@ void CheckAndStoreIntToDescriptor(
6464
// the CMDSTAT variable is not present, error termination is initiated.
6565
int TerminationCheck(int status, const Descriptor *cmdstat,
6666
const Descriptor *cmdmsg, Terminator &terminator) {
67-
if (status == -1) {
68-
if (!cmdstat) {
69-
terminator.Crash("Execution error with system status code: %d", status);
70-
} else {
71-
StoreIntToDescriptor(cmdstat, EXECL_ERR, terminator);
72-
CheckAndCopyCharsToDescriptor(cmdmsg, "Execution error");
73-
}
74-
}
75-
7667
#ifdef _WIN32
7768
// On WIN32 API std::system returns exit status directly
7869
int exitStatusVal{status};
@@ -88,6 +79,14 @@ int TerminationCheck(int status, const Descriptor *cmdstat,
8879
CheckAndCopyCharsToDescriptor(cmdmsg, "Invalid command line");
8980
}
9081
}
82+
if (status == -1) {
83+
if (!cmdstat) {
84+
terminator.Crash("Execution error with system status code: %d", status);
85+
} else {
86+
StoreIntToDescriptor(cmdstat, EXECL_ERR, terminator);
87+
CheckAndCopyCharsToDescriptor(cmdmsg, "Execution error");
88+
}
89+
}
9190

9291
#if defined(WIFSIGNALED) && defined(WTERMSIG)
9392
if (WIFSIGNALED(status)) {

0 commit comments

Comments
 (0)