Fix soft-delete hanging on *nix when the command was not found
When execvp() failed to replace the stack, the forked process would return to Blender's WM_main(..) loop then hang when attempting to draw the window. Resolve by calling _exit() when execvp fails.
This commit is contained in:
@@ -1253,10 +1253,15 @@ static int delete_soft(const char *filepath, const char **error_message)
|
||||
return 0;
|
||||
}
|
||||
|
||||
execvp(args[0], (char **)args);
|
||||
const int status = execvp(args[0], (char **)args);
|
||||
|
||||
*error_message = "Forking process failed.";
|
||||
return -1; /* This should only be reached if `execvp` fails and stack isn't replaced. */
|
||||
/* This should only be reached if `execvp` fails and stack isn't replaced. */
|
||||
/* Use `_exit` instead of `exit` so Blender's `atexit` cleanup functions don't run. */
|
||||
_exit(status);
|
||||
|
||||
BLI_assert_unreachable();
|
||||
|
||||
return -1;
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user