8000 Emit only sane pgid value for `jobs` output by mqudsi · Pull Request #10833 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

Emit only sane pgid value for jobs output#10833

Merged
mqudsi merged 1 commit intofish-shell:masterfrom
mqudsi:jobs_no_pgid
Nov 8, 2024
Merged

Emit only sane pgid value for jobs output#10833
mqudsi merged 1 commit intofish-shell:masterfrom
mqudsi:jobs_no_pgid

Conversation

@mqudsi
Copy link
Contributor
@mqudsi mqudsi commented Nov 5, 2024

We were previously printing the internal INVALID_PID value (since removed), which was a meaningless -2 constant, when there was no pgid associated with a job.

This PR changes that to - to indicate no pgid available, which I prefer over something like 0 or -1, but will cause problems for any code out there that is hardcoded to convert this field to an integral value (do we have any code like that ourselves?).

Other options include 0 or -1 as mentioned above, or printing fish's own pgid.

EDIT:

I don't recommend printing 0 or fish's own pgid because if those get through validation we could end up killing ourself or something equally disasterous.

We were previously printing the internal INVALID_PID value (since removed),
which was a meaningless `-2` constant, when there was no pgid associated with a
job.

This PR changes that to `-` to indicate no pgid available, which I prefer over
something like `0` or `-1`, but will cause problems for code that is hardcoded
to convert this field to an integral value.

Other options include 0 or -1 as mentioned above, or printing fish's own pgid.
@krobelus
Copy link
Contributor
krobelus commented Nov 7, 2024

LGTM. This fixes the output of fish -c 'sleep 10 & jobs'

@mqudsi mqudsi merged commit 9fddc3e into fish-shell:master Nov 8, 2024
@zanchey zanchey added this to the fish 4.0 milestone Jan 2, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0