Changeset 3383 for src/Main.hs

Show
Ignore:
Timestamp:
05/18/05 10:52:42 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
4972
Message:

* Gruber reports that getContents was closing stdin, rendering

echo '"x" /y/' | ./pugs -

unusable. Fixed.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Main.hs

    r3238 r3383  
    8181 
    8282run (("-e"):prog:args)          = do doRun "-e" args prog 
    83 run ("-":args)                  = do 
    84                                     prog <- getContents 
    85                                     doRun "-" args prog 
     83run ("-":args)                  = do doRun "-" args =<< readStdin 
    8684run (file:args)                 = readFile file >>= doRun file args 
    8785run []                          = do 
     
    9088        then do banner >> intro >> repLoop 
    9189        else run ["-"] 
     90 
     91readStdin = do 
     92    eof     <- isEOF 
     93    if eof then return [] else do 
     94    ch      <- getChar 
     95    rest    <- readStdin 
     96    return (ch:rest) 
    9297 
    9398-- convenience functions for GHCi