mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-28 00:24:19 +00:00
abffa8f6c9
The process cmd, done and exitErr fields were written by Start/startCommand and the waitForCommand goroutine while IsRunning/GetErr/GetResult/Stop read them concurrently from other goroutines (the status endpoint and the check-xray job) — a data race. Guard them with a RWMutex: writers take the write lock; readers snapshot under the read lock and run any blocking syscall (Wait/Signal/Kill) on the local copy without holding it. IsRunning now uses the done channel as the exit signal instead of reading cmd.ProcessState, which races with cmd.Wait. Adds a -race regression test.