Skip to content
Snippets Groups Projects
  • Simon Marlow's avatar
    1b44d689
    FIX: #724 (tee complains if used in a process started by ghc) · 1b44d689
    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.
    1b44d689
    History
    FIX: #724 (tee complains if used in a process started by ghc)
    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.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.