Skip to content

Commit

Permalink
Fix wrong error on process exit Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Apr 29, 2024
1 parent b3837f4 commit ccd62bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hldebug-wrapper/src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ HL_API int hl_debug_wait( int pid, int *thread, int timeout ) {
// With it, and more we wait, less we miss stop event.
usleep(100 * 1000);
int ret = waitpid(pid, &status, WNOHANG);
if( ret == -1 && errno == ECHILD ) {
*thread = pid;
return 0;
}
*thread = ret;
if( ret == -1 && errno != EINTR )
return 3;
if( ret <= 0 )
return -1;
if( WIFEXITED(status) )
Expand Down

0 comments on commit ccd62bb

Please sign in to comment.