I create a windows native program - runs as a server
I create a linux native program - runs a server
I spawn the linux native program from the windows program, in a certain distribution using wsl.exe utility
What did you see happen?
When I close the native windows process, the child wsl does not exit.
What I notice is that wsl.exe launcher does some kind of forking, when it wraps and I see that the processes get detached from the main spawner. When I try to check if os.Getppid() process still exists in the linux binary, it is not able to find it.
On windows, the process tree looks like this after spawning, notice the windows process that launched the entire tree
Upon closing electron, the windows native process exits properly container-desktop-ssh-relay.exe
But what I see happening is that the processes under it, get detached and move to window's root process
The WSL linux golang program, is wrapped by wsl.exe at process 31112
What did you expect to see?
If the spawned program would be for example a native C based binary of /usr/sbin/sshd server (from openssh-server), started without running in the background, the exit process is proper and all the process tree gets killed.
Go version
go version go1.22.2 linux/amd64
Output of
go env
in your module/workspace:What did you do?
wsl.exe
utilityWhat did you see happen?
When I close the native windows process, the child wsl does not exit.
What I notice is that
wsl.exe
launcher does some kind of forking, when it wraps and I see that the processes get detached from the main spawner. When I try to check ifos.Getppid()
process still exists in the linux binary, it is not able to find it.On windows, the process tree looks like this after spawning, notice the windows process that launched the entire tree
Upon closing electron, the windows native process exits properly
container-desktop-ssh-relay.exe
But what I see happening is that the processes under it, get detached and move to window's root process
The WSL linux golang program, is wrapped by
wsl.exe
at process31112
What did you expect to see?
If the spawned program would be for example a native C based binary of
/usr/sbin/sshd
server (from openssh-server), started without running in the background, the exit process is proper and all the process tree gets killed.I would expect the process tree to die properly.