1717import platform
1818import psutil
1919import re
20- import shlex
2120import signal
2221import subprocess
2322import sys
@@ -395,8 +394,6 @@ def __del__(self):
395394 except Exception :
396395 if self ._omc_process :
397396 print ("OMC did not exit after being sent the quit() command; killing the process with pid={self._omc_process.pid}" )
398- if sys .platform != "win32" :
399- os .killpg (os .getpgid (self ._omc_process .pid ), signal .SIGTERM )
400397 self ._omc_process .kill ()
401398 self ._omc_process .wait ()
402399
@@ -419,9 +416,8 @@ def _start_omc_process(self, timeout):
419416 # set the user environment variable so omc running from wsgi has the same user as OMPython
420417 my_env = os .environ .copy ()
421418 my_env ["USER" ] = self ._currentUser
422- # Because we spawned a shell, and we need to be able to kill OMC, create a new process group for this
423- self ._omc_process = subprocess .Popen (self ._omc_command , shell = True , stdout = self ._omc_log_file ,
424- stderr = self ._omc_log_file , env = my_env , preexec_fn = os .setsid )
419+ self ._omc_process = subprocess .Popen (self ._omc_command , stdout = self ._omc_log_file ,
420+ stderr = self ._omc_log_file , env = my_env )
425421 if self ._docker :
426422 for i in range (0 , 40 ):
427423 try :
@@ -510,12 +506,7 @@ def _set_omc_command(self, omc_path_and_args_list):
510506 if self ._interactivePort :
511507 extraFlags = extraFlags + ["--interactivePort=%d" % int (self ._interactivePort )]
512508
513- omc_path_and_args_list = omcCommand + omc_path_and_args_list + extraFlags
514-
515- if sys .platform == 'win32' :
516- self ._omc_command = omc_path_and_args_list
517- else :
518- self ._omc_command = ' ' .join ([shlex .quote (a ) for a in omc_path_and_args_list ])
509+ self ._omc_command = omcCommand + omc_path_and_args_list + extraFlags
519510
520511 return self ._omc_command
521512
0 commit comments