mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 03:03:57 +08:00
exec: Don't format status returned directly from builtin function
The builtin function returns the raw status, which is not the same as the integer return by waitpid. Therefore, the WIF macros shouldn't be used for checking or obtaining the status. This bug can be seen by executing (eval false). The builtin eval function returns 1, but proc_format_status misinterprets it as a signal by checking WIFSIGNALED, so adds 128 to the status to return 129. Signed-off-by: Grissiom <chaos.proton@gmail.com>
This commit is contained in:
parent
9f3a4d1640
commit
364d3dbbf8
2
exec.c
2
exec.c
|
@ -1575,7 +1575,7 @@ void exec( job_t *j )
|
||||||
{
|
{
|
||||||
debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status );
|
debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status );
|
||||||
|
|
||||||
int status = proc_format_status(p->status);
|
int status = p->status;
|
||||||
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?(!status):status );
|
proc_set_last_status( job_get_flag( j, JOB_NEGATE )?(!status):status );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user