mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-28 21:41:15 -03:00
fg: remove rogue abs() on PID argument
Present since the initial commit but I don't think anyone relies on this.
This commit is contained in:
@@ -70,17 +70,19 @@ pub fn fg(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Built
|
||||
job = None;
|
||||
} else {
|
||||
match fish_wcstoi(argv[optind]) {
|
||||
Err(_) => {
|
||||
streams
|
||||
.err
|
||||
.append(wgettext_fmt!(BUILTIN_ERR_NOT_NUMBER, cmd, argv[optind]));
|
||||
Ok(..0) | Err(_) => {
|
||||
streams.err.append(wgettext_fmt!(
|
||||
"%s: '%s' is not a valid process ID",
|
||||
cmd,
|
||||
argv[optind]
|
||||
));
|
||||
job_pos = None;
|
||||
job = None;
|
||||
builtin_print_error_trailer(parser, streams.err, cmd);
|
||||
}
|
||||
Ok(pid) => {
|
||||
let raw_pid = pid;
|
||||
let pid = Pid::new(pid.abs());
|
||||
let pid = Pid::new(pid);
|
||||
let j = pid.and_then(|pid| parser.job_get_with_index_from_pid(pid));
|
||||
if j.as_ref()
|
||||
.map_or(true, |(_pos, j)| !j.is_constructed() || j.is_completed())
|
||||
|
||||
9
tests/checks/fg.fish
Normal file
9
tests/checks/fg.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
# RUN: %fish %s
|
||||
|
||||
builtin fg -- -1
|
||||
# CHECKERR: fg: '-1' is not a valid process ID
|
||||
# CHECKERR: {{.*}}/fg.fish (line {{\d+}}):
|
||||
# CHECKERR: builtin fg -- -1
|
||||
# CHECKERR: ^
|
||||
# CHECKERR:
|
||||
# CHECKERR: (Type 'help fg' for related documentation)
|
||||
Reference in New Issue
Block a user