bg: deduplicate job argument

"bg %1" of a pipline prints the same line twice because it tries
to background the same job twice.  This doesn't make sense and
other builtins like "disown" already deduplicate, so do the same.
Unfortunately we can't use the same approach as "disown" because we
can't hold on to references to job, since we're modifying the job list.
This commit is contained in:
Johannes Altmanninger
2025-10-11 12:23:36 +02:00
parent f7d730390c
commit c41fc52077
2 changed files with 15 additions and 2 deletions

View File

@@ -17,3 +17,11 @@ isolated-tmux capture-pane -p
# CHECK: fish: Job 1, 'sleep 0.5 &' has ended
# (I've seen this print " world", I guess it depends on tmux version and how big it thinks the terminal is)
# CHECK: {{.*}} world
isolated-tmux send-keys C-u C-l "sleep 3 | cat &" Enter "bg %1" Enter
tmux-sleep
isolated-tmux capture-pane -p | string match -v '*has stopped*'
# CHECK: prompt 0> sleep 3 | cat &
# CHECK: prompt 0> bg %1
# CHECK: Send job 1 'sleep 3 | cat &' to background
# CHECK: prompt 1>