Addition to unix: raw ByteString APIs

Balazs Komuves bkomuves at
Mon Nov 14 18:05:30 CET 2011

On Fri, Nov 11, 2011 at 7:59 PM, Evan Laforge <qdunkan at> wrote:

> > System.Environment exports:
> >
> > getProgName :: IO String
> >
> > maybe System.Posix.ByteString should export a similar function:
> >
> > getProgName :: IO ByteString
> Yeah, that's actually not the same as argv[0], it has the path to the
> binary stripped.  So you can't really use it to restart yourself
> because you have no way to know what directory the binary was in.
> It's frustrating because you can see in the source that it's going to
> some effort to intentionally strip off information that you can't get
> elsewhere.
FYI, there are at least two libraries out there trying to solve this

Unfortunately, there is no standardized way on different unix systems
to access the path of the executable running (it's not even fully
clear what it means in the presence of symlinks, etc). Actually it seems
to be impossible to do this (without argv[0]) on certain BSD systems.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list