File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -671,19 +671,22 @@ int main(int argc, char *argv[]) {
671671 exit (EXIT_EXECERROR );
672672 }
673673
674- int rv = waitpid (pid , NULL , 0 );
674+ int status = 0 ;
675+ int rv = waitpid (pid , & status , 0 );
676+ status = rv > 0 && WIFEXITED (status ) ? WEXITSTATUS (status ) : EXIT_EXECERROR ;
675677
676678 if (getenv ("NO_CLEANUP" ) == NULL ) {
677679 if (!rm_recursive (prefix )) {
678680 fprintf (stderr , "Failed to clean up cache directory\n" );
679- rv = -1 ;
681+ if (status == 0 ) /* avoid messing existing failure exit status */
682+ status = EXIT_EXECERROR ;
680683 }
681684 }
682685
683686 // template == prefix, must be freed only once
684687 free (prefix );
685688
686- exit (rv >= 0 ? 0 : EXIT_EXECERROR );
689+ exit (status );
687690 }
688691
689692 if (arg && strcmp (arg ,"appimage-version" )== 0 ) {
You can’t perform that action at this time.
0 commit comments