Skip to content

jobs ignores -q for invalid PIDs #6809

@soumya92

Description

@soumya92

fish, version 3.0.2

In a script, I want to see whether a previous job is still running. I saw a "--quiet" flag, so I thought the following would work:

start-the-job &
set -l pid (jobs -lp)
# ... stuff ...
if jobs -q $pid
  echo "Job is still running"
end

But if the job has finished, this still prints jobs: No suitable job: 47362.

In fact, if the PID does not point to a fish job, there's no difference in the behaviour of jobs $badpid and jobs -q $badpid.

Is it reasonable to make the -q flag suppress that output as well? I've looked at the code and it doesn't seem like a huge change, but I'm not sure if there are reasons to not make this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    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