Skip to content

cmd_execute_and_stream_data: Determine right exit codes#305

Merged
ras0219-msft merged 1 commit intomicrosoft:mainfrom
autoantwort:determine-right-exit-codes
Jan 7, 2022
Merged

cmd_execute_and_stream_data: Determine right exit codes#305
ras0219-msft merged 1 commit intomicrosoft:mainfrom
autoantwort:determine-right-exit-codes

Conversation

@autoantwort
Copy link
Copy Markdown
Contributor

According to https://linux.die.net/man/3/pclose:

The pclose() function waits for the associated process to terminate and returns the exit status of the command as returned by wait4(2).

And from https://linux.die.net/man/2/wait4:

Return Value
As for waitpid(2).

And from https://linux.die.net/man/2/waitpid:

WIFEXITED(status)
____ returns true if the child terminated normally, that is, by calling exit(3) or _exit(2), or by returning from main().
WEXITSTATUS(status)
____ returns the exit status of the child. This consists of the least significant 8 bits of the status argument that the child specified in a call to exit(3) or _exit(2) or as the argument for a return statement in main(). This macro should only be employed if WIFEXITED returned true.
WIFSIGNALED(status)
____ returns true if the child process was terminated by a signal.
WTERMSIG(status)
____ returns the number of the signal that caused the child process to terminate. This macro should only be employed if WIFSIGNALED returned true.
WCOREDUMP(status)
____ returns true if the child produced a core dump. This macro should only be employed if WIFSIGNALED returned true. This macro is not specified in POSIX.1-2001 and is not available on some UNIX implementations (e.g., AIX, SunOS). Only use this enclosed in #ifdef WCOREDUMP ... #endif.
WIFSTOPPED(status)
____ returns true if the child process was stopped by delivery of a signal; this is only possible if the call was done using WUNTRACED or when the child is being traced (see ptrace(2)).
WSTOPSIG(status)
____ returns the number of the signal which caused the child to stop. This macro should only be employed if WIFSTOPPED returned true.

@autoantwort
Copy link
Copy Markdown
Contributor Author

And include the thread prefix in the output so that you can see which debug messages belongs together when multiple threads are used to unpack the binary cache

@autoantwort autoantwort force-pushed the determine-right-exit-codes branch from dcfe0ca to 23e1d11 Compare December 20, 2021 17:43
@ras0219-msft
Copy link
Copy Markdown
Collaborator

This seems trivially positive to me, thanks for catching this pretty serious bug!

@ras0219-msft ras0219-msft merged commit 195ca1c into microsoft:main Jan 7, 2022
@autoantwort autoantwort deleted the determine-right-exit-codes branch February 5, 2022 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants