Philosophy: The reason for creating soldier is to provide a user-friendly and pythonic API on top the subprocess module in order to manage system processes in python.

After successfully installing soldier, you will now be able to communicate with system processes without making your eyes bleed.

Get output of pwd command

>> import soldier
>> current_path ='pwd')
>> print(current_path.output)
# Status Code
>> print(current_path.status_code)

Run a process in background, and later terminate it

>> firefox_proc ='firefox', background=True)
# Get pid of firefox process
>> print(
# Kill firefox
>> firefox_proc.kill()
>> firefox_proc.is_alive()
>> False

Run a root command

>>'service nginx start', sudo='my_password')

Run a command with timeout

>>'./', timeout=10, kill_on_timeout=True)

# Handle timeouts
>> try'./', timeout=5, kill_on_timeout=False)
   except soldier.ProcessTimeoutError:
       print("Your script timed out")
Your script timed out