Hello zsh users, I've encountered an unusual bug using zsh and I finally have a reliable reproduction so I'm looking for some insight. The issue is as follows: === $ sudo true [sudo] password for ronan: $ pacman -Qttdq | sudo pacman -Rns - [...] :: Do you want to remove these packages? [Y/n] zsh: done pacman -Qttdq | zsh: suspended (tty output) sudo pacman -Rns - === When I try to pipe a package list for pacman to read from stdin, the job is mysteriously suspended by zsh when "pacman -Rns -" prompts [Y/n] for confirmation to continue, before I have a chance to input anything. I have not input the SUSP character. The issue is also reproducible from a 'zsh -f' in a clean environment. Trying to 'fg' the suspended job always results in the following error: === $ fg[1] + done pacman -Qttdq | continued sudo pacman -Rns - zsh: can't set tty pgrp: no such process === I can only reproduce in zsh, not bash. The issue also only occurs when sudo *does not* prompt for a password, which is why I use a "sudo true" to temporarily authorize my user before demonstrating the issue. Bizarrely, the following examples all work as intended: === # with an extra file $ pacman -Qttdq > packages.txt; cat packages.txt | sudo pacman -Rns - [...] :: Do you want to remove these packages? [Y/n] # with an extra cat $ pacman -Qttdq | cat - | sudo pacman -Rns - [...] :: Do you want to remove these packages? [Y/n] # with process substitution $ sudo pacman -Rns - < <(pacman -Qttdq) [...] :: Do you want to remove these packages? [Y/n] === To exonerate pacman, a user from #archlinux helped create a script that exhibits similar behavior: === $ cat read-and-prompt.sh#!/bin/sh -- exec 3<&1 while IFS= read -r input; do printf '%s\n' "$input" >&3 done exec < /dev/tty printf 'prompt: ' >&2 read -r _ exec "$@" <&3 $ for a in a b c; do print "$a"; sleep 1; done | sudo ./read-and-prompt.sh cat a b c prompt:zsh: done for a in a b c; do; print "$a"; sleep 1; done | zsh: suspended (tty input) sudo ./read-and-prompt.sh cat === They also report that they cannot reproduce using doas in place of sudo. Considering the above, I believe my issue is a bug in either sudo or zsh, hence why I am asking here. Why is zsh suspending this job? My understanding is that jobs are suspended only in response to a signal, but I do not know where it could be generated in this case.