Mon Apr 30 11:40:46 PDT 2007 Duncan Coutts <[EMAIL PROTECTED]>
* Use rawSystem not system for capturing output of commands
For example we were using a wrapper around 'system' to find the haddock
version. This invokes the system command interpreter and passes the
command to run as an argument. If the command has spaces in it and is not
properly escaped then everything goes wrong. This happens for example
on windows when haddock and other programs are kept under "Program Files".
So the right thing to do is never to use system, but always rawSystem since
then there are no escaping issues.
This patch replaces a couple function systemCaptureStdout and systemGetStdout
with rawSystemStdout which now lives in Distribution.Simple.Utils.
This also uses some rather nasty code to get the output of a command.
It really really should not be this hard to do portably. To work around
the fact that we cannot use runInteractiveProcess we instead have to create
a temporary file. This also turns out to be a hack because the 'standard'
openTempFile is not implemented except by GHC, so we now have a hacky version
living in Distribution.Compat.TempFile just waiting for the standard
openTempFile to be made properly portable, or for us to get some
System.Process function that does what we want.
M ./Cabal.cabal -1 +2
A ./Distribution/Compat/TempFile.hs
M ./Distribution/Simple/Configure.hs -32 +7
M ./Distribution/Simple/Utils.hs -36 +30
_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries