Documentation
¶
Overview ¶
Package selfpath resolves the path Stormlight re-invokes itself by.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Resolve ¶
Resolve returns a path to the running executable that will still start Stormlight after an upgrade.
os.Executable answers with the real file behind the process, which for a packaged install is version-stamped — Homebrew's cask resolves `bin/stormlight` to `Caskroom/stormlight/0.6.3/stormlight`. Stormlight hands that path to provider hooks as $STORMLIGHT_BIN, and both outlive the process that computed them: the next upgrade deletes the binary out from under every agent still running, and their hooks start failing with "No such file or directory".
The launcher on PATH is the stable name for the same program, so prefer it — but only once it is confirmed to be the same file. A development build run out of a worktree must keep its own path even though an installed `stormlight` shadows it on PATH, or end-to-end runs would silently exercise the installed binary instead of the one under test.
Once the running binary has actually been deleted that preference has nothing left to protect, and the identity check cannot run at all — there is no file to compare a candidate against. Rather than hand back a path that starts nothing, fall back to whatever PATH offers under the same name.
Types ¶
This section is empty.