##// END OF EJS Templates
FIX: updated ssh environment copying to escape special characters for posix compatibility
Satrajit Ghosh -
Show More
@@ -419,6 +419,13 b' engine_killer_template="""#!/bin/sh'
419 419 ps -fu `whoami` | grep '[i]pengine' | awk '{print $2}' | xargs kill -TERM
420 420 """
421 421
422 def escape_strings(val):
423 val = val.replace('(','\(')
424 val = val.replace(')','\)')
425 if ' ' in val:
426 val = '"%s"'%val
427 return val
428
422 429 class SSHEngineSet(object):
423 430 sshx_template_prefix=sshx_template_prefix
424 431 sshx_template_suffix=sshx_template_suffix
@@ -445,8 +452,9 b' class SSHEngineSet(object):'
445 452 f = open(self.sshx, 'w')
446 453 f.writelines(self.sshx_template_prefix)
447 454 if copyenvs:
448 for key, val in os.environ.items():
449 f.writelines('export %s=%s\n'%(key,val))
455 for key, val in sorted(os.environ.items()):
456 newval = escape_strings(val)
457 f.writelines('export %s=%s\n'%(key,newval))
450 458 f.writelines(self.sshx_template_suffix)
451 459 f.close()
452 460 self.engine_command = ipengine
General Comments 0
You need to be logged in to leave comments. Login now