On Arch Linux, I often minimize the terminal window in which I am upgrading my system to work on something else. I usually do this while pacman is resolving dependencies, which can take a long time on my system, and while it is installing the packages themselves. The problem is, pacman requires user input to continue after resolving dependencies. I do not want to skip this user input because I want to check what pacman will do before continuing.
I would like to write a script like undistract-me that would notify me when a process (like pacman) began to block while waiting for input from stdin. How could I check whether the process is in this state? I considered trying to use the waiting channel, but pacman remains in waiting channel 0.