I am trying to run a bash script through the process class and do something when I use process.kil() But it seems that the exit signal isn't triggered so:
A. Is it possible?
B. If it isn't possible is there a way to send a signal to the process?
Script.sh
#!/bin/bash
Exit(){
echo "terminated">>log.txt
kill $child}
trap Exit EXIT
daemon &
child=$!
echo $child > log.txt
wait $child
C# code:
Process script = new Process()
script.StartInfo.Filename = "Script.sh"
script.Start()
//Other stuff
script.Kill()
C# script.Kill doesn't seem to trigger Exit() in Script.sh
Exiting through ubuntu's system monitor does trigger it though.
Edit:
Changing the signal to SIGTERM didn't change the results.