convert so they handle argsfiles rather than arguments

reviewable/pr18780/r1
Seth Vidal 13 years ago committed by Michael DeHaan
parent 26b18d8b85
commit 903178cdd4

@ -27,6 +27,8 @@ import subprocess
import sys import sys
import datetime import datetime
import traceback import traceback
import shlex
import os
if len(sys.argv) == 1: if len(sys.argv) == 1:
print json.dumps({ print json.dumps({
@ -35,7 +37,25 @@ if len(sys.argv) == 1:
}) })
sys.exit(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() startd = datetime.datetime.now()
try: try:

25
git

@ -37,8 +37,31 @@ import subprocess
# to a dictionary # to a dictionary
# FIXME: make more idiomatic # FIXME: make more idiomatic
args = " ".join(sys.argv[1:]) if len(sys.argv) == 1:
print json.dumps({
"failed" : True,
"msg" : "the command module requires arguments (-a)"
})
sys.exit(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()
items = shlex.split(args) items = shlex.split(args)
if not len(items):
print json.dumps({
"failed" : True,
"msg" : "the command module requires arguments (-a)"
})
sys.exit(1)
params = {} params = {}
for x in items: for x in items:
(k, v) = x.split("=") (k, v) = x.split("=")

@ -31,8 +31,33 @@ import subprocess
# to a dictionary # to a dictionary
# FIXME: make more idiomatic # FIXME: make more idiomatic
args = " ".join(sys.argv[1:])
items = shlex.split(args) if len(sys.argv) == 1:
print json.dumps({
"failed" : True,
"msg" : "the command module requires arguments (-a)"
})
sys.exit(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()
itmes = shlex.split(args)
if not len(items):
print json.dumps({
"failed" : True,
"msg" : "the command module requires arguments (-a)"
})
sys.exit(1)
params = {} params = {}
for x in items: for x in items:
(k, v) = x.split("=") (k, v) = x.split("=")

Loading…
Cancel
Save