Bug 9931

Summary: stdin is not restored to blocking mode after a process exits
Product: Busybox Reporter: Robbert <robbertkl>
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs, niko.mauno
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Robbert 2017-06-02 12:37:24 UTC
The fix for #9851 happened in vi, but the underlying issue affects any other process as well. Most tools can't handle stdin being in non-blocking mode. If you start a process that changes stdin to non-blocking (node js does this, for example) it gets left in non-blocking mode after the process exits. Cat and nano are examples of tools that cannot be started after this:

$ cat
cat: read error: Resource temporarily unavailable

Instead of the fix in vi (#9851), it should be fixed in the shell itself. After the foreground process exits, it should reset stdin to block mode. I believe this is what other shells do.