convert so they handle argsfiles rather than arguments

This commit is contained in:
Seth Vidal
2012-03-14 00:39:18 -04:00
committed by Michael DeHaan
parent a9a9e3af65
commit 1f53c89b14
3 changed files with 72 additions and 4 deletions

View File

@@ -27,6 +27,8 @@ import subprocess
import sys
import datetime
import traceback
import shlex
import os
if len(sys.argv) == 1:
print json.dumps({
@@ -35,7 +37,25 @@ if len(sys.argv) == 1:
})
sys.exit(1)
args = sys.argv[1:]
argfile = sys.argv[1]
if not os.path.exists(argfile):
print json.dumps({
"failed" : True,
"msg" : "Argument file not found"
})
sys.exit(1)
args = open(argfile, 'r').read()
args = shlex.split(args)
if not len(args):
print json.dumps({
"failed" : True,
"msg" : "the command module requires arguments (-a)"
})
sys.exit(1)
startd = datetime.datetime.now()
try: