From 943cf03d8ec93de8879b81cfde83cc70f0586f53 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 18 Oct 2020 15:24:23 +0200 Subject: [PATCH] Only send the PID of the last process in a job to builtin fg jobs -p %1 prints all processes in the first job. fg is special because it only takes one argument. Using the last process in the pipeline works for the cases I can think of. Fixes #7406 --- CHANGELOG.rst | 1 + share/config.fish | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 49ab5c2b1..4762dc5eb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -138,6 +138,7 @@ Interactive improvements - The fish Web configuration tool (``fish_config``) shows prompts correctly on Termux for Android (#7298) and detects Windows Services for Linux 2 properly (#7027). - ``funcsave`` has a new ``--directory`` option to specify the location of the saved function (#7041). - ``help`` works properly on MSYS2 (#7113). +- Resuming a piped job by its number, like ``fg %1`` has been fixed (#7406). New or improved bindings diff --git a/share/config.fish b/share/config.fish index 050df3102..16a404303 100644 --- a/share/config.fish +++ b/share/config.fish @@ -226,11 +226,14 @@ function __fish_expand_pid_args end end -for jobbltn in bg fg wait disown +for jobbltn in bg wait disown function $jobbltn -V jobbltn builtin $jobbltn (__fish_expand_pid_args $argv) end end +function fg + builtin fg (__fish_expand_pid_args $argv)[-1] +end function kill command kill (__fish_expand_pid_args $argv)