"#!..." (Re: cabal configure screw-up)
kr.angelov at gmail.com
Fri Aug 26 02:37:20 EDT 2005
2005/8/25, Ross Paterson <ross at soi.city.ac.uk>:
> On Thu, Aug 25, 2005 at 12:03:25PM +0400, Bulat Ziganshin wrote:
> > Thursday, August 25, 2005, 7:37:39 AM, Frederik Eaton wrote:
> > FE> I guess you could try to parse the "#!" line if MinGW is detected? ...
> > FE> Anyway, it would seem that support for running "#!" scripts from
> > FE> Haskell is a problem which is much more general than Cabal and should
> > FE> be solved more centrally, like in the standard libraries.
> > i strongly agree. ignoring of first line if it starts from "#" must
> > be added to all Haskell realizations
> I think Frederik is suggesting that under Windows, System.Cmd.rawSystem
> and friends should examine the start of the file it is asked to execute,
> looking for #! and then try to simulate Unix behaviour. That might help
> some things, but it won't always work, so may not be worth it.
> Haskell implementations already ignore lines starting with # if the file
> is a literate script.
It isn't so easy to simulate #! behaviour in rawSystem because the
file path after #! is in Unix style. Cygwin keeps the mapping between
Unix style paths and the native Windows paths. Usually /usr/bin/sh is
mapped to something like c:\cygwin\bin\sh.exe. All executables which
are compiled with cygwin.dll runtime library are working with Unix
paths which are silently mapped to native paths. All GHC compiled
executables are linked to the native msvcrt.dll runtime library so
they understands only the native paths. I don't think that rawSystem
should try to emulate Unix behaviour.
More information about the Libraries