#669·webview

closing window causes the child process to be called an orphan process

Author: levinitCreated Feb 13, 2022Updated Dec 16, 2025

What OS are you using (uname -a, or Windows version)?

intel x86_64 darwin (macos 12.2.1) intel x86_64 linux (ubuntu 20.04LTS Gnome Desktop)

What programming language are you using (C/C++/Go/Rust)?

go 1.17.6

What did you expect to see and what you saw instead?

I write a app named demo-app, and run a extra program in main thread by os/exec,

run it in terminal:

bash
./demo-app

the pstree like below:

bash
-+= 89923 user1 ./demo-app
 \--- 89942 user1 /usr/local/bin/app1

If I click the close button of window, the child process will not be killed , it will become an orphan process , but press ctrl + c in terminal, child process will be killed.

How can I kill child process after click close btn, or how can I control the behavior when I click the close button?