Parse arguments rather than forking out a shell
This commit is contained in:
parent
3b57c5f247
commit
880f1c637d
@ -40,8 +40,7 @@ if len(activities) == 0:
|
|||||||
print 'Activity not found.'
|
print 'Activity not found.'
|
||||||
|
|
||||||
activity = activities[0]
|
activity = activities[0]
|
||||||
cmd_args = activityfactory.get_command(activity).split(' ')
|
cmd_args = activityfactory.get_command(activity)
|
||||||
print cmd_args
|
|
||||||
|
|
||||||
def _get_interpreter(exec_file):
|
def _get_interpreter(exec_file):
|
||||||
if os.path.exists(exec_file):
|
if os.path.exists(exec_file):
|
||||||
@ -66,7 +65,5 @@ if options.debug:
|
|||||||
cmd_args.extend(_get_interpreter(act_args.pop(0)))
|
cmd_args.extend(_get_interpreter(act_args.pop(0)))
|
||||||
cmd_args.extend(act_args)
|
cmd_args.extend(act_args)
|
||||||
|
|
||||||
print cmd_args
|
|
||||||
|
|
||||||
os.execvpe(cmd_args[0], cmd_args, activityfactory.get_environment(activity))
|
os.execvpe(cmd_args[0], cmd_args, activityfactory.get_environment(activity))
|
||||||
|
|
||||||
|
@ -88,14 +88,16 @@ def get_command(activity, activity_id=None, object_id=None, uri=None):
|
|||||||
if not activity_id:
|
if not activity_id:
|
||||||
activity_id = create_activity_id()
|
activity_id = create_activity_id()
|
||||||
|
|
||||||
command = activity.command
|
command = activity.command.split(' ')
|
||||||
command += ' -b %s' % activity.bundle_id
|
command.extend(['-b', activity.bundle_id])
|
||||||
command += ' -a %s' % activity_id
|
command.extend(['-a', activity_id])
|
||||||
|
|
||||||
if object_id is not None:
|
if object_id is not None:
|
||||||
command += ' -o %s' % object_id
|
command.extend(['-o', object_id])
|
||||||
if uri is not None:
|
if uri is not None:
|
||||||
command += ' -u %s' % uri
|
command.extend(['-u', uri])
|
||||||
|
|
||||||
|
print command
|
||||||
|
|
||||||
return command
|
return command
|
||||||
|
|
||||||
@ -184,9 +186,8 @@ class ActivityCreationHandler(gobject.GObject):
|
|||||||
command = get_command(activity, self._handle.activity_id,
|
command = get_command(activity, self._handle.activity_id,
|
||||||
self._handle.object_id,
|
self._handle.object_id,
|
||||||
self._handle.uri)
|
self._handle.uri)
|
||||||
process = subprocess.Popen(command, env=env, shell=True,
|
process = subprocess.Popen(command, env=env, cwd=activity.path,
|
||||||
cwd=activity.path, stdout=log_file,
|
stdout=log_file, stderr=log_file)
|
||||||
stderr=log_file)
|
|
||||||
else:
|
else:
|
||||||
system_bus = dbus.SystemBus()
|
system_bus = dbus.SystemBus()
|
||||||
factory = system_bus.get_object(_RAINBOW_SERVICE_NAME,
|
factory = system_bus.get_object(_RAINBOW_SERVICE_NAME,
|
||||||
|
Loading…
Reference in New Issue
Block a user