Files
Behavision/agent/pkg/engine/tree_other.go
Suriyakumarvijayanayagam 8c88aad06e Stopping the engine on Windows stops the whole engine
The installer runs the engine as <venv>\Scripts\python.exe, and since
Python 3.7.2 that file is a redirector that spawns the real interpreter
as a child. Stop() terminated the redirector and left the interpreter -
the process holding the cameras and the SQLite WAL - running with no
parent and nothing able to stop it. Seen on a Windows install: Quit from
the tray, and recognition still running.

The child is now started suspended, placed in a job object with
KILL_ON_JOB_CLOSE, and resumed. Cancel terminates the job, so the whole
tree goes; and the job dies with this process, so it goes even if the app
crashes. CREATE_NO_WINDOW while here: python.exe is a console program
and a GUI parent otherwise opens a black console on the shop counter.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGcjxF1cNLcuwc3DAPcnfj
2026-09-18 11:06:49 +05:30

14 lines
334 B
Go

//go:build !windows
package engine
import "os/exec"
// On every other platform the engine is one process and exec's own kill is
// enough. See tree_windows.go for why Windows is not.
func prepare(*exec.Cmd) {}
func confine(cmd *exec.Cmd) (kill func() error, release func(), err error) {
return cmd.Process.Kill, func() {}, nil
}