Prevent socat from orphaning EXEC: processes?

Viewed 497

I'm creating a quick socat TCP listener and then running a simple expect script.

Let's start the listener:

socat TCP-LISTEN:5000,fork EXEC:my_exp_script

Which then listens on port 5000, accepts, forks, and executes my_exp_script here:

#!/usr/bin/expect
expect {
         "hello" { send "world" ; exp_continue }
}

Simple enough BUT every my_exp_script forked process orphans when the connection dies (and requires a kill -9). How do I ensure non-ophaning of socat's spawned processes?

0 Answers
Related