I\'m planning to control some programs (like a media player and a shell) via a webapp, since the webpage die everytime the user visits it, I decided that the webapp will ope
Only somewhat intricate methods using strace
come to my mind.
If you can do without redirecting standard error:
read _ _ sid < <(2>&1 strace -esetsid setsid bash -i <fifoin >fifoout)
echo $sid
If you need to redirect standard error:
strace -o/tmp/filename -esetsid setsid bash -i <fifoin >fifoout 2>&1 &
sleep 1 # Hope 1 s is long enough
read _ _ sid </tmp/filename
echo $sid
You still need to background the process with &
, otherwise it'll be running in the foreground blocking the following lines from even attempting to execute.
setsid bash -i <fifoin >fifoout 2>&1 &
kill $!