The relaunch after an update stopped working, and the regression is mine: removing the PowerShell helper — which is what Defender was reading as a dropper — also removed the wait it was doing. Nothing took over the job. The numbers made it certain rather than unlucky. The instance being replaced is allowed THIRTY seconds to shut down (armExitWatchdog forces it out at that point) because it closes a remote logbook, a CAT session and sometimes a backup. The new instance was patient with the single-instance mutex for TWENTY. On any station where shutting down ran past that, the new process gave up and exited in silence: no window after an update, and the previous OpsLog still in the task manager. Exactly the report. Both relaunch paths now pass --wait-pid, and the new process waits on that process's handle — a plain kernel wait, which ends the instant the old one ends, however long or short that is, and looks nothing like a script starting another program. The mutex retry stays as a backstop and goes to forty-five seconds, so it is longer than the wait it exists for rather than shorter. And when the old process really has not gone, the message says that instead of "OpsLog is already running" — after an update the operator did not start a second copy, and what they need to know is which one to close. A test keeps the two spawn sites honest: a relaunch added without --wait-pid is this bug again.
17 lines
652 B
Go
17 lines
652 B
Go
//go:build !windows || bindings
|
|
|
|
package main
|
|
|
|
import "time"
|
|
|
|
// acquireSingleInstance is a no-op off Windows (the guard uses a Windows named
|
|
// mutex), and during Wails' binding generation (the `bindings` tag) — that step
|
|
// runs this binary, and a real OpsLog already running would otherwise make it
|
|
// exit before Wails could reflect the bindings.
|
|
func acquireSingleInstance() bool { return true }
|
|
|
|
// waitForProcessExit has nothing to wait on off Windows: there is no
|
|
// single-instance guard there either, so the relaunch never has to queue behind
|
|
// the old process.
|
|
func waitForProcessExit(pid int, timeout time.Duration) bool { return true }
|