Reputation: 5152
I am currently re-working a file that uses the Subprocess module of python. The lines starting the proccesses are the following:
cmd = ["/usr/bin/time", '-f', '%e %M %P', '-o', time_file, script]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
In the first line the time_file
and script
are a file to temporarily store runtime infos (such as used ram, cpu, etc.) and the script to run, repectively.
But I don't understand the first arguments in the list ("/usr/bin/time", '-f', '%e %M %P', '-o'
).
Anyone can help me decipher, or point me to a piece of doc that can help me understand what are those arguments, and how to create my own list of arguments?
Upvotes: 0
Views: 35
Reputation: 2322
The first argument /usr/bin/time
is the name of the program which is run in the subprocess, and the subsequent elements in the cmd
list are the arguments for that program. You can learn more about its usage by typing man time
in your shell, or by visiting the documentation.
You can also learn more about the Popen object and the subprocess module here.
Upvotes: 1