Skip to content

Commit b84ea1f

Browse files
authored
Merge pull request #336 from GaneshPatil7517/fix/mkconcore-arg-validation-v2
fix: move argument validation before sys.argv access in mkconcore.py (fixes #267)
2 parents e2cae65 + 9e8e756 commit b84ea1f

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

mkconcore.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ def _resolve_concore_path():
137137
return os.getcwd()
138138
return SCRIPT_DIR
139139

140+
if len(sys.argv) < 4:
141+
print("usage: py mkconcore.py file.graphml sourcedir outdir [type]")
142+
print(" type must be posix (macos or ubuntu), windows, or docker")
143+
sys.exit(1)
144+
140145
GRAPHML_FILE = sys.argv[1]
141146
TRIMMED_LOGS = True
142147
CONCOREPATH = _resolve_concore_path()
@@ -202,11 +207,7 @@ def _resolve_concore_path():
202207
logging.error(f"{sourcedir} does not exist")
203208
quit()
204209

205-
if len(sys.argv) < 4:
206-
logging.error("usage: py mkconcore.py file.graphml sourcedir outdir [type]")
207-
logging.error(" type must be posix (macos or ubuntu), windows, or docker")
208-
quit()
209-
elif len(sys.argv) == 4:
210+
if len(sys.argv) == 4:
210211
prefixedgenode = outdir+"_" #nodes and edges prefixed with outdir_ only in case no type specified 3/24/21
211212
concoretype = "docker"
212213
else:

0 commit comments

Comments
 (0)