Open GottemHams opened 2 weeks ago
brew services
has never tried to cleanup PIDs on a crash. It would be a good feature request for it to do so, if that's what you're proposing, but to set expectations: it might be a while before anyone who isn't you picks this up and implements it.
Also, yes, Homebrew doesn't automatically run launchctl bootout
for you.
brew services
is a relatively thin wrapper (on macOS) around launchctl
so it doesn't really "automatically" do very much at all.
it might be a while before anyone [...] picks this up
That's cool, at least I know why it won't start and can get it working again relatively easily.
The crash was not related to anything Homebrew, but after it booted back up I noticed Apache wouldn't start. Trying some things, it looks like the PID file it originally created keeps lingering around and Apache itself refuses to start because of it. The same will probably true for any other service that uses PID files on its own.
Some shell output, with extra line breaks to make it a bit more readable:
Since Homebrew does know that the service is not actually running despite there being an actual process with that exact PID, I would presume that it's fairly easy to recognise if the PID file should be removed/emptied upon receiving a
start
command?Also notice how I need to explicitly stop the service first, even though
brew services
already saysstopped
. I think Homebrew doesn't automaticallylaunchctl bootout
when the service previously stopped unexpectedly (or never fully starts up, in this case)? So it tries to executelaunchctl bootstrap
for a service that's still "active", resulting in that particular error. While technically this makes perfect sense, it's a bit inconsistent with the output ofbrew services
saying it's stopped. You would expect simplybrew services start ...
to be sufficient.In case it matters: the version of my
homebrew-services
is commit34637816b6d34a6f9414758ceaa410437c4e997c
, which should be latestmaster
.