Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to terminate exec process? #196

Open
k0xxxx opened this issue Aug 29, 2023 · 3 comments
Open

how to terminate exec process? #196

k0xxxx opened this issue Aug 29, 2023 · 3 comments

Comments

@k0xxxx
Copy link

k0xxxx commented Aug 29, 2023

Hello dear Vi! I use websocat -E ws-l:127.0.0.1:8080 exec:"cmd"
I connect to a websocket using a browser and run the program from the command line
echo {"method":"SUBSCRIBE","params":["test"],"id":100} | websocat -n wss:/server.com/ws | php script.php argv1 argv2. It can run indefinitely. How can I interrupt (terminate) the execution of the program from the browser? I tried sending "^C" but it doesn't work in windows.

@vi
Copy link
Owner

vi commented Aug 30, 2023

Try newly added option --exec-exit-on-disconnect from 734cc58.

@k0xxxx
Copy link
Author

k0xxxx commented Sep 1, 2023

Dear Vi. In OS Windows 10 it option "--exec-exit-on-disconnect" is work. After connect to ws on port 8080, i close my web browser and i see this message on windows cmd terminal
D:\D\OpenServer\modules\php\PHP_7.4>websocat -t --exec-exit-on-disconnect -E ws-l:127.0.0.1:8080 exec:cmd websocat: other error websocat: error running
and created php.exe process is terminated. But when I tried to show the same in Ubuntu,
./websocat -t -E --exec-exit-on-disconnect -v ws-l:1.2.3.4:9000 exec:sh
the php.exe process still running in the background.

UPDATE
this bug stay while my php script do not send any echo "message"; to the terminal console

@vi
Copy link
Owner

vi commented Sep 17, 2023

I tried websocat -t -E --exec-exit-on-disconnect -v ws-l:127.0.0.1:9000 cmd:'ping 127.0.0.1' with and without --exec-exit-on-disconnect. With the option, it does terminate process even on Linux, but does not free up the PID (i.e. leaves a zombie).

Until this is fixed, you may want to use --exec-sighup-on-stdin-close on Linux.

vi added a commit that referenced this issue Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants