mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 21:44:16 +00:00
lint: Use early exit/continue
This commit is contained in:
parent
6c3900ff64
commit
26c1430e82
1 changed files with 26 additions and 25 deletions
|
@ -1174,10 +1174,12 @@ static int exec_subshell_internal(const wcstring &cmd, wcstring_list_t *lst,
|
|||
// If the caller asked us to preserve the exit status, restore the old status. Otherwise set the
|
||||
// status of the subcommand.
|
||||
proc_set_last_status(apply_exit_status ? subcommand_status : prev_status);
|
||||
|
||||
is_subshell = prev_subshell;
|
||||
|
||||
if (lst != NULL && io_buffer.get() != NULL) {
|
||||
if (lst == NULL || io_buffer.get() == NULL) {
|
||||
return subcommand_status;
|
||||
}
|
||||
|
||||
const char *begin = io_buffer->out_buffer_ptr();
|
||||
const char *end = begin + io_buffer->out_buffer_size();
|
||||
if (split_output) {
|
||||
|
@ -1198,14 +1200,13 @@ static int exec_subshell_internal(const wcstring &cmd, wcstring_list_t *lst,
|
|||
cursor = stop + (hit_separator ? 1 : 0);
|
||||
}
|
||||
} else {
|
||||
// we're not splitting output, but we still want to trim off a trailing newline.
|
||||
// We're not splitting output, but we still want to trim off a trailing newline.
|
||||
if (end != begin && end[-1] == '\n') {
|
||||
--end;
|
||||
}
|
||||
const wcstring wc = str2wcstring(begin, end - begin);
|
||||
lst->push_back(wc);
|
||||
}
|
||||
}
|
||||
|
||||
return subcommand_status;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue