<html><head><style type="text/css">body {word-wrap: break-word; background-color:#ffffff;}</style></head><body><div style="font-family: sans-serif; font-size: 16px">That's true even for regular fork/exec. </div><br><br>-----Original message-----<br><blockquote style="; border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: sans-serif; font-size: 14px"><b>From: </b>Richard O&apos;Keefe &lt;ok@cs.otago.ac.nz&gt;<b><br>To: </b>wren ng thornton &lt;wren@freegeek.org&gt;<b><br>Cc: </b>haskell-cafe &lt;haskell-cafe@haskell.org&gt;<b><br>Sent: </b>Sun, Dec 4, 2011 15:54:15 PST<b><br>Subject: </b>Re: [Haskell-cafe] How to get a file path to the program invoked?<br><br></div><br>On 4/12/2011, at 7:32 PM, wren ng thornton wrote:<br>> Part of the problem is that, as Alexey says, the first element of argv is just whatever is passed to exec, which is not guaranteed to be a complete path, a canonical path, or any other specific thing we'd desire. It's not at all straightforward to determine the actual location of the executable, especially not in a platform-independent manner. argv[0] can't be trusted, scanning through $PATH isn't guaranteed to find it (and even if you find something of the right name, it's not guaranteed to be the correct executable), etc etc.<br><br>In particular, with posix_spawnp(), the $PATH that is used to find the executable<br>and the $PATH in the environment that the executable starts with can be two different things.<br><br><br>_______________________________________________<br>Haskell-Cafe mailing list<br>Haskell-Cafe@haskell.org<br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></blockquote></body></html>