Skip to content
  • Simon Marlow's avatar
    FIX: #724 (tee complains if used in a process started by ghc) · d8f90d7f
    Simon Marlow authored
    Now, we only set O_NONBLOCK on file descriptors that we create
    ourselves.  File descriptors that we inherit (stdin, stdout, stderr)
    are kept in blocking mode.  The way we deal with this differs between
    the threaded and non-threaded runtimes:
    
     - with -threaded, we just make a safe foreign call to read(), which
       may block, but this is ok.
    
     - without -threaded, we test the descriptor with select() before
       attempting any I/O.  This isn't completely safe - someone else
       might read the data between the select() and the read() - but it's
       a reasonable compromise and doesn't seem to measurably affect
       performance.
    d8f90d7f