##// 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 ps -fu `whoami` | grep '[i]pengine' | awk '{print $2}' | xargs kill -TERM
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 class SSHEngineSet(object):
429 class SSHEngineSet(object):
423 sshx_template_prefix=sshx_template_prefix
430 sshx_template_prefix=sshx_template_prefix
424 sshx_template_suffix=sshx_template_suffix
431 sshx_template_suffix=sshx_template_suffix
@@ -445,8 +452,9 b' class SSHEngineSet(object):'
445 f = open(self.sshx, 'w')
452 f = open(self.sshx, 'w')
446 f.writelines(self.sshx_template_prefix)
453 f.writelines(self.sshx_template_prefix)
447 if copyenvs:
454 if copyenvs:
448 for key, val in os.environ.items():
455 for key, val in sorted(os.environ.items()):
449 f.writelines('export %s=%s\n'%(key,val))
456 newval = escape_strings(val)
457 f.writelines('export %s=%s\n'%(key,newval))
450 f.writelines(self.sshx_template_suffix)
458 f.writelines(self.sshx_template_suffix)
451 f.close()
459 f.close()
452 self.engine_command = ipengine
460 self.engine_command = ipengine
General Comments 0
You need to be logged in to leave comments. Login now