I'm using pkill to send USR2 signal to suricata by python subprocess as below:
#!/usr/bin/python3
script_command='pkill -SIGUSR2 -f /usr/bin/suricata'
exit_status = subprocess.call(script_command, env=self.config_environment, shell=True)
the result is: exit_status = -12
When I executed on terminal:
pkill -SIGUSR2 -f /usr/bin/suricata
echo $?
the result is: 0
As I understand the document said at https://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess.returncode
Does Python detect return code of pkill
process or suricata
process is 12?
How can I bypass this mechanism and force subprocess.call
return 0 when pkill
send USR2 to suricata successfully and negative exit code corresponding to pkill
process's feedback?