Sample Header Ad - 728x90

Why SIGTSTP (^Z/Ctrl-Z/suspend) doesn't work when process blocked redirecting write into a FIFO/pipe not open for reading yet? And what to do then?

3 votes
1 answer
200 views
Sometimes, a command is stalled attempting to write to a FIFO/pipe that no other process is currently reading from, but typing Ctrl-Z to put the process to the background by sending it the SIGTSTP signal (i.e. the *suspend* non-printing control character ^Z) does work. Example: $ mkfifo p $ ll p prw-rw-r-- 1 me me 0 Jul 30 16:27 p| $ echo "Go!" >p # Here & has been forgotten after the >p redirection (stalled) [Ctrl-Z] ^Z # Pressing Ctrl-Z just prints "^Z" on the terminal, nothing else happens [Ctrl-D] # Attempting to send the EOF character (nothing) # Doesn't print "^D" and does nothing and this is the behavior even though SIGTSTP (or susp) is reported to be attached to ^Z: $ stty -a speed 38400 baud; rows 24; columns 91; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; swtch = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0; -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff -iuclc -ixany -imaxbel iutf8 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc How comes that in this case the terminal does not catch and transmit to the process the SIGTSTP signal generated by the Ctrl-Z? Is it because redirecting with > to a FIFO/pipe puts the terminal in raw mode (cf. The TTY demystified )? But if so, why does "^Z" get printed on the screen, and why Ctrl-D (EOF) doesn't print anything and yet doesn't have any effect either? Incidentally, is there an alternative way to send the stalled process to the background in such cases (instead of just terminate the process with Ctrl-C (i.e. ^C / SIGINT)?
Asked by The Quark (402 rep)
Aug 5, 2025, 08:47 AM
Last activity: Aug 5, 2025, 12:02 PM