Skip to content

Inconsistent job ids #6053

@horst5000

Description

@horst5000

I must admit that the job handling is very weird in fish, since the job id seems to be pretty random. Quick example, where I start different tools in the prescribed order and send them to background (ccmake, nano, man gcc, vim, vi where vi is an alias to nvim -O). The output of jobs is extremely unexpected, since man gcc will receive jobid 5 instead of 3. vim started as fourth tool will receive 4. The nvim alias started last will receive 7.

jobs
Job     Group   CPU     State   Command
7       30462   0%      stopped nvim  $argv
4       30393   0%      stopped vim
5       30348   0%      stopped command man $argv
2       30308   0%      stopped nano
1       30273   0%      stopped ccmake .

Or simply starting man gcc and then vim results in job 1 and 2 not even being present

Job     Group   CPU     State   Command
4       1716    0%      stopped nvim  $argv
3       1660    0%      stopped command man $argv

In short, the job ids are not consecutive, which is weird, but even worse they are not even monotonically increasing. This effectively makes the use of commands using these ids such as fg/bg %id trial and error and significantly less useful compared to most other shells.

fish version: 3.0.2
Sys: Ubuntu 18.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions