mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=1470
This commit is contained in:
parent
5a723a61a4
commit
1138ff8651
13
sched/start
13
sched/start
|
@ -226,14 +226,23 @@ def lock_file(filename):
|
||||||
except IOError:
|
except IOError:
|
||||||
return -1
|
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):
|
def exec_command_string(command):
|
||||||
args = command.split()
|
args = command.strip().split()
|
||||||
# set default path for program to <bin_dir>:
|
# set default path for program to <bin_dir>:
|
||||||
args[0] = os.path.realpath(os.path.join( bin_dir, args[0] ))
|
args[0] = os.path.realpath(os.path.join( bin_dir, args[0] ))
|
||||||
os.chdir(log_dir)
|
os.chdir(log_dir)
|
||||||
try:
|
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
|
# on success we don't reach here
|
||||||
|
print >>sys.stderr, "Couldn't exec '%s'"%command
|
||||||
except OSError, e:
|
except OSError, e:
|
||||||
print >>sys.stderr, "Couldn't execute '%s':" %command, e
|
print >>sys.stderr, "Couldn't execute '%s':" %command, e
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
Loading…
Reference in New Issue