mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-22 12:58:47 +08:00
Rename select_try_t::IO_ERROR to select_try_t::IOCHAIN_EMPTY
select_try() returned IO_ERROR to indicate that there's no file descriptors from which to read. Name this return value properly. Also migrate this type into proc.cpp since it's not used outside of the header.
This commit is contained in:
parent
03ec48c701
commit
fd13043340
28
src/proc.cpp
28
src/proc.cpp
|
@ -766,6 +766,16 @@ void proc_update_jiffies() {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// The return value of select_try(), indicating IO readiness or an error
|
||||||
|
enum class select_try_t {
|
||||||
|
/// One or more fds have data ready for read
|
||||||
|
DATA_READY,
|
||||||
|
/// The timeout elapsed without any data becoming available for read
|
||||||
|
TIMEOUT,
|
||||||
|
/// There were no FDs in the io chain for which to select on.
|
||||||
|
IOCHAIN_EMPTY,
|
||||||
|
};
|
||||||
|
|
||||||
/// Check if there are buffers associated with the job, and select on them for a while if available.
|
/// Check if there are buffers associated with the job, and select on them for a while if available.
|
||||||
///
|
///
|
||||||
/// \param j the job to test
|
/// \param j the job to test
|
||||||
|
@ -801,7 +811,7 @@ static select_try_t select_try(job_t *j) {
|
||||||
return select_try_t::DATA_READY;
|
return select_try_t::DATA_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return select_try_t::IO_ERROR;
|
return select_try_t::IOCHAIN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Read from descriptors until they are empty.
|
/// Read from descriptors until they are empty.
|
||||||
|
@ -1088,22 +1098,16 @@ void job_t::continue_job(bool send_sigcont) {
|
||||||
case select_try_t::TIMEOUT:
|
case select_try_t::TIMEOUT:
|
||||||
// Our select_try() timeout is ~10ms, so this can be EXTREMELY chatty but this
|
// Our select_try() timeout is ~10ms, so this can be EXTREMELY chatty but this
|
||||||
// is very useful if trying to debug an unknown hang in fish. Uncomment to see
|
// is very useful if trying to debug an unknown hang in fish. Uncomment to see
|
||||||
// if we're stuck here. debug(1, L"select_try: no fds returned valid data
|
// if we're stuck here.
|
||||||
// within the timeout" );
|
|
||||||
|
// debug(1, L"select_try: no fds returned valid data within the timeout" );
|
||||||
|
|
||||||
// No FDs are ready. Look for finished processes instead.
|
// No FDs are ready. Look for finished processes instead.
|
||||||
process_mark_finished_children(block_on_fg);
|
process_mark_finished_children(block_on_fg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case select_try_t::IO_ERROR:
|
case select_try_t::IOCHAIN_EMPTY:
|
||||||
// This is easily encountered by simply transferring control of the terminal to
|
// There were no IO fds to select on.
|
||||||
// another process, then suspending it. For example, `nvim`, then `ctrl+z`.
|
|
||||||
// Since we are not the foreground process
|
|
||||||
debug(3, L"select_try: interrupted read from job file descriptors");
|
|
||||||
|
|
||||||
// This tends to happen when the foreground process has changed, e.g. it was
|
|
||||||
// suspended and control has returned to the shell or when a fg process takes
|
|
||||||
// initial control of the shell.
|
|
||||||
process_mark_finished_children(true);
|
process_mark_finished_children(true);
|
||||||
|
|
||||||
// If it turns out that we encountered this because the file descriptor we were
|
// If it turns out that we encountered this because the file descriptor we were
|
||||||
|
|
10
src/proc.h
10
src/proc.h
|
@ -41,16 +41,6 @@ enum {
|
||||||
JOB_CONTROL_NONE,
|
JOB_CONTROL_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The return value of select_try(), indicating IO readiness or an error
|
|
||||||
enum class select_try_t {
|
|
||||||
/// One or more fds have data ready for read
|
|
||||||
DATA_READY,
|
|
||||||
/// The timeout elapsed without any data becoming available for read
|
|
||||||
TIMEOUT,
|
|
||||||
/// The select operation was aborted due to an interrupt or IO error
|
|
||||||
IO_ERROR,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// A structure representing a single fish process. Contains variables for tracking process state
|
/// A structure representing a single fish process. Contains variables for tracking process state
|
||||||
/// and the process argument list. Actually, a fish process can be either a regular external
|
/// and the process argument list. Actually, a fish process can be either a regular external
|
||||||
/// process, an internal builtin which may or may not spawn a fake IO process during execution, a
|
/// process, an internal builtin which may or may not spawn a fake IO process during execution, a
|
||||||
|
|
Loading…
Reference in New Issue
Block a user