From 1138ff8651917e808903769ed7f76ee86fdd8b21 Mon Sep 17 00:00:00 2001 From: Karl Chen Date: Sat, 14 Jun 2003 21:40:01 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=1470 --- sched/start | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sched/start b/sched/start index 59f06fa2f8..3852022f30 100755 --- a/sched/start +++ b/sched/start @@ -226,14 +226,23 @@ def lock_file(filename): except IOError: return -1 +def contains_shell_characters(command): + return ('"' in command or "'" in command or + '\\' in command or '|' in command or + '>' in command) + def exec_command_string(command): - args = command.split() + args = command.strip().split() # set default path for program to : args[0] = os.path.realpath(os.path.join( bin_dir, args[0] )) os.chdir(log_dir) try: - os.execv( args[0], args ) + if contains_shell_characters(command): + os.execl('/bin/sh', 'sh', '-c', ' '.join(args)) + else: + os.execv( args[0], args ) # on success we don't reach here + print >>sys.stderr, "Couldn't exec '%s'"%command except OSError, e: print >>sys.stderr, "Couldn't execute '%s':" %command, e os._exit(1)