[Haskell-cafe] Strange behavior of executeFile

Krzysztof Kościuszkiewicz k.kosciuszkiewicz at gmail.com
Sun Jul 29 12:33:19 EDT 2007


Fellow Haskellers,

I wrote a small script that intercepts arguments and exec's the pstops
program. The intention was to center and scale pages in a document
before processing it by psnup.

So far so good, I've ended up with something like:

> runPstops :: [Flag] -> IO ()
> runPstops flags =
>   do let args = mkArgs flags
>      when (isVerbose flags) $ do
>           hPutStrLn stderr $ "pstops " ++ unwords (map show args)
>      executeFile "pstops" True args Nothing

> main = do (opts, _) <- getOptions =<< getArgs
>           runPstops opts

This works for files, but "randomly" fails when stdin is connected to
a pipe (pstops complains that it can't seek input).  I've tested "raw"
pstops with pipes, files and /dev/null and it never fails, so I guess
there is something wrong with my code. Can anyone enlighten me in this
matter? :)

Regards,
-- 
Krzysztof Kościuszkiewicz
Skype: dr.vee,  Gadu: 111851,  Jabber: kokr at jabberpl.org
Phone IRL: +353851383329,  Phone PL: +48783303040
"Simplicity is the ultimate sophistication" -- Leonardo da Vinci


More information about the Haskell-Cafe mailing list