+ # Management of -t <script.py>
+ toimport = []
+ if 'gui' in args and 'session_gui' in args:
+ if not args['gui'] or not args['session_gui']:
+ if 'study_hdf' in args:
+ toopen = args['study_hdf']
+ if toopen:
+ import salome
+ salome.salome_init(path=toopen)
+ if 'pyscript' in args:
+ toimport = args['pyscript']
+ from salomeContextUtils import formatScriptsAndArgs
+ from addToKillList import addToKillList
+ command = formatScriptsAndArgs(toimport, escapeSpaces=True)
+ if command:
+ logger.debug("Launching following shell command : {}".format(str(command)))
+ proc = subprocess.Popen(command, shell=True)
+ addToKillList(proc.pid, command)
+ res = proc.wait()
+ if res: sys.exit(1)