mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
494 B
Plaintext
28 lines
494 B
Plaintext
13 years ago
|
#!/usr/bin/python
|
||
|
|
||
|
import json
|
||
|
import subprocess
|
||
|
import sys
|
||
|
import datetime
|
||
|
|
||
|
args = sys.argv[1:]
|
||
|
startd = datetime.datetime.now()
|
||
|
|
||
|
cmd = subprocess.Popen(args, shell=True,
|
||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||
|
|
||
|
out, err = cmd.communicate()
|
||
|
endd = datetime.datetime.now()
|
||
|
delta = endd - startd
|
||
|
|
||
|
result = {
|
||
|
"stdout" : out,
|
||
|
"stderr" : err,
|
||
|
"rc" : cmd.returncode,
|
||
|
"start" : str(startd),
|
||
|
"end" : str(endd),
|
||
|
"delta" : str(delta),
|
||
|
}
|
||
|
|
||
|
print json.dumps(result)
|