Skip to content

Backgrounding a command that was piped into leads to weird results and bad error messages. #7406

@ericonr

Description

@ericonr
  • fish, version 3.1.2
  • Linux mussels 5.9.1_1 Need a history built-in #1 SMP Sun Oct 18 02:56:13 UTC 2020 x86_64 GNU/Linux
  • TERM=alacritty

I have tried with "vanilla" fish, and can still see the problem.

To reproduce:

$ cat a | nvim

Where nvim can be pretty much any command that doesn't immediately quit and doesn't complain about stdin not being a terminal.

Then, background nvim with ^Z. jobs output will then be a bit weird, as seen below:

$ jobs
1	13564	0%	stopped	cat a | nvim
$ jobs -p
13564
13566

More importantly, fg %1 errors out with a cryptic error message:

$ fg %1
fg: '13564' is not a job

/usr/share/fish/config.fish (line 275): 
        builtin $jobbltn (__fish_expand_pid_args $argv)
        ^
in function 'fg' with arguments '\%1'

(Type 'help fg' for related documentation)

However, running simply fg or fg %2 works perfectly.

I'm not entirely sure what the best way of showing error messages and dealing with jobs like these is, but I don't think the current one is very good, and can probably get at least better error messages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions