Created
March 21, 2014 08:04
-
-
Save fordnox/9681706 to your computer and use it in GitHub Desktop.
python proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import json | |
from subprocess import Popen, PIPE | |
txt = raw_input(); | |
cmd = txt.split() | |
o = None | |
e =None | |
try: | |
p = Popen(cmd, stdout=PIPE, stderr=PIPE) | |
o, e = p.communicate() | |
except: | |
e = str(sys.exc_info()[0]) | |
print json.dumps({"stdout": o, "stderr":e}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment