> On 31 Mar 2025, at 21:02, Brett Neumeier via skaware > <skaware@list.skarnet.org> wrote: > > On 3/31/25 1:48 PM, Damir Simunic wrote: > >> The TLDR; is that getcwd and s6-dirname do not provide a desired answer when >> something messes with the process cwd and argv[0]. >> >> [...] >> The launched process receives this very minimal environment: default path, >> CWD set to /, and the name of the service; launched executable is wired to >> stdout and stdin as configured (or /dev/null by default if not specified). > > Is there a reason you can't just write a script that sets the environment the > way you want and then execs into s6-svscan, and have launchd run that script > instead of directly running s6-svscan? That seems like it would be pretty > straightforward, unless I'm missing something. >
Any script runs under the same limitations of the minimal environment. `getcwd PATH s6-svscan` would have been enough had it known how to get its own path under launchd. Hence this little modification.