Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Elvish cannot find its binary to start daemon #496
It seems that if
I see an error like the following:
Workaround: Use the
referenced this issue
Oct 10, 2017
The way Elvish finds itself is either from PATH or from argv. This works most of the time, but unfortunately if you are running Elvish from somewhere not in PATH and as a login shell, Elvish won't be able to find itself, causing the error above. Login shells have argv like
You also mentioned on Telegram that putting Elvish in
To use Elvish as the "pseudo" login shell, the way I configure Terminal.app is by setting the following option in the profile configuration:
Be sure to enable "run inside shell", so that all environment variables set by bash are honored.
A bit more on the background: Go does not support a simple fork syscall, only a fork-exec combo (as syscall.ForkExec). There is a good reason behind this: all Go binaries are multithreaded, and fork and threading do not work well together; here is one post but there are many other similar articles.
Due to this limitation, when forking the daemon, Elvish cannot just fork its own process; instead it has to find its binary and do a fork-exec on the same binary. To do this it first needs to know where its own binary it is. It uses argv if it is available, and then falls back to PATH.