without a shell to avoid double shell expansion.
# Handle command line parameters
parser = argparse.ArgumentParser(
# Handle command line parameters
parser = argparse.ArgumentParser(
- description='Mount Keep data under the local filesystem.')
+ description='Mount Keep data under the local filesystem.',
+ epilog="""
+Note: When using the --exec feature, you must either specify the
+mountpoint before --exec, or mark the end of your --exec arguments
+with "--".
+""")
parser.add_argument('mountpoint', type=str, help="""Mount point.""")
parser.add_argument('--collection', type=str, help="""Collection locator""")
parser.add_argument('--debug', action='store_true', help="""Debug mode""")
parser.add_argument('mountpoint', type=str, help="""Mount point.""")
parser.add_argument('--collection', type=str, help="""Collection locator""")
parser.add_argument('--debug', action='store_true', help="""Debug mode""")
- parser.add_argument('--exec', type=str, help="""Mount, run a command, then unmount and exit""", dest="ex")
+ parser.add_argument('--exec', type=str, nargs=argparse.REMAINDER,
+ dest="exec_args", metavar=('command', 'args', '...', '--'),
+ help="""Mount, run a command, then unmount and exit""")
args = parser.parse_args()
args = parser.parse_args()
# Initialize the fuse connection
llfuse.init(operations, args.mountpoint, opts)
# Initialize the fuse connection
llfuse.init(operations, args.mountpoint, opts)
t = threading.Thread(None, lambda: llfuse.main())
t.start()
t = threading.Thread(None, lambda: llfuse.main())
t.start()
operations.initlock.wait()
try:
operations.initlock.wait()
try:
- rc = subprocess.call(args.ex, shell=True)
+ rc = subprocess.call(args.exec_args, shell=False)
except:
rc = 255
finally:
except:
rc = 255
finally: