Skip to content
Snippets Groups Projects
Commit ba8b7dc2 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Adjust imcp/immv exit code management

parent 0494f48f
No related branches found
No related tags found
No related merge requests found
...@@ -43,13 +43,15 @@ def main(argv=None): ...@@ -43,13 +43,15 @@ def main(argv=None):
argv = sys.argv[1:] argv = sys.argv[1:]
if len(argv) < 2: if len(argv) < 2:
raise RuntimeError(usage) print(usage)
return 1
srcs = argv[:-1] srcs = argv[:-1]
dest = argv[ -1] dest = argv[ -1]
if len(srcs) > 1 and not op.isdir(dest): if len(srcs) > 1 and not op.isdir(dest):
raise RuntimeError(usage) print(usage)
return 1
srcs = fslpath.removeDuplicates(srcs, srcs = fslpath.removeDuplicates(srcs,
allowedExts=fslimage.ALLOWED_EXTENSIONS, allowedExts=fslimage.ALLOWED_EXTENSIONS,
...@@ -58,11 +60,8 @@ def main(argv=None): ...@@ -58,11 +60,8 @@ def main(argv=None):
for src in srcs: for src in srcs:
imcp.imcp(src, dest, useDefaultExt=True, overwrite=True) imcp.imcp(src, dest, useDefaultExt=True, overwrite=True)
return 0
if __name__ == '__main__':
try: if __name__ == '__main__':
main() sys.exit(main())
except Exception as e:
print(e)
sys.exit(1)
...@@ -44,13 +44,15 @@ def main(argv=None): ...@@ -44,13 +44,15 @@ def main(argv=None):
argv = sys.argv[1:] argv = sys.argv[1:]
if len(argv) < 2: if len(argv) < 2:
raise RuntimeError(usage) print(usage)
return 1
srcs = argv[:-1] srcs = argv[:-1]
dest = argv[ -1] dest = argv[ -1]
if len(srcs) > 1 and not op.isdir(dest): if len(srcs) > 1 and not op.isdir(dest):
raise RuntimeError(usage) print(usage)
return 1
srcs = fslpath.removeDuplicates(srcs, srcs = fslpath.removeDuplicates(srcs,
allowedExts=fslimage.ALLOWED_EXTENSIONS, allowedExts=fslimage.ALLOWED_EXTENSIONS,
...@@ -59,10 +61,8 @@ def main(argv=None): ...@@ -59,10 +61,8 @@ def main(argv=None):
for src in srcs: for src in srcs:
imcp.immv(src, dest, useDefaultExt=True, overwrite=True) imcp.immv(src, dest, useDefaultExt=True, overwrite=True)
return 0
if __name__ == '__main__': if __name__ == '__main__':
try: sys.exit(main())
main()
except Exception as e:
print(e)
sys.exit(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment