[darcs-devel] [issue845] pass through stderr from ssh (because ssh prompts can block)
Jeff Foster
bugs at darcs.net
Sun Aug 14 13:06:57 UTC 2011
Jeff Foster <jeff.foster at acm.org> added the comment:
Removing the probably easy tag.
The problem with filtering the messages is that the only access to the
output of the external program is through a Handle type. This is
opaque, so it's difficult to filter.
We experimented by using createProcess in conjunction with CreatePipe.
The basic idea is simple:
applySomeFilter :: (String -> String) -> IO ()
applySomeFilter f = do
(_,Just hout,_,_) <- createProcess (proc "cat" ["/dev/zero"]){
std_out = CreatePipe }
readWrite hout stdout f
readWrite :: Handle -> Handle -> (String -> String) -> IO ()
readWrite from to f = do
x <- hGetContents from
hPutStr to (f x)
However, it gets very complicated in the general case. For example,
what if putty/scp goes mad and outputs exceedingly long lines or binary
content?
Perhaps the easiest way forward is to pass through binary content, and
assume that text input is less than N characters per line. This should
make it possible to filter out particular lines.
----------
topic: -ProbablyEasy
__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue845>
__________________________________
More information about the darcs-devel
mailing list