Problem with ghc on Windows ME

Simon Marlow simonmar at
Thu Jan 29 17:42:55 EST 2004

> > It's called 'raw' because it is supposed to get the 
> arguments through
> > *unmodified* to the called program.  No file globbing, no 
> escape stuff, nothing.
> That's exactly what I'm worried about: it seems that rawSystem is
> *not* passing the arguments unmodified, but tries to compensate for
> windows interpretation, from a unix perspective (*).

No, the effect is that the arguments are passed unmodified to the
program.  The implementation of rawSystem might have to do some
compensation under the hood (eg. on Windows), but that's not visible to
the client.

> As long as "raw" means "unmodified", I just have the problem of
> finding the appropriate documentation for the system I'm working
> on (after all, that's why it's in System). But if there are two
> interpreters fighting with each other for some unstable balance,
> things do not look so promising.
> For instance, I can't use rawSystem in ghc-6.x because there are
> already two different versions in circulation, and a third one
> planned. So, instead of simplifying my code, I'd have to triplicate
> it, and add version testing, which adds preprocessing..

This is an unfortunate situation, granted.  ghc-6.0.x had a version of
rawSystem that was not very raw: on Windows there was a layer of
translation between rawSystem and the invoked program, and on Unix it
didn't even allow you to pass any arguments to the program.  We thought
this was wrong, and decided to make rawSystem truly raw.

Unfortunately we got it slightly wrong in 6.2.  6.2.1 will be better (I
hope), and in the meantime we can offer an implementation of rawSystem
that you can use locally to work around the differences - how does that

> Therefore, my suggestion would be to keep the rawSystem from
> ghc-6.0.1 (which doesn't seem to do any interpretation?), and
> to provide a system-specific escape function
>   System.Cmd.escape :: String -> String -> String
>   -- (System.Cmd.escape chars string) escapes occurrences of 
>   -- chars in string, according to convention on the current
>   -- system
> If really necessary, there could be a convenience function
> somewhat like:
>   -- try to do "the right thing"
>   System.Cmd.rawSystem' :: String -> [String] -> IO ExitCode
>   System.Cmd.rawSystem' path args =
>     rawSystem $ concat (path:[' ':(escape "\\\"" a) | a <- args])

I don't think it's necessary to do any of this, if rawSystem works as
it's intended.  But I may have misunderstood your intention...


More information about the Glasgow-haskell-users mailing list