Browse Source

AMBARI-9891. Ambari-agent stop on Ubuntu fails (aonishuk)

Andrew Onishuk 10 years ago
parent
commit
b432db1c78
1 changed files with 3 additions and 2 deletions
  1. 3 2
      ambari-common/src/main/python/ambari_commons/shell.py

+ 3 - 2
ambari-common/src/main/python/ambari_commons/shell.py

@@ -161,8 +161,9 @@ class shellRunnerLinux:
     if isinstance(script, list):
       cmd = " ".join(script)
 
-    p = subprocess.Popen(cmd, preexec_fn=_changeUid, stdout=subprocess.PIPE,
-                         stderr=subprocess.PIPE, shell=True, close_fds=True)
+    cmd_list = ["/bin/bash","--login","--noprofile","-c", cmd]
+    p = subprocess.Popen(cmd_list, preexec_fn=_changeUid, stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE, shell=False, close_fds=True)
     out, err = p.communicate()
     code = p.wait()
     logger.debug("Exitcode for %s is %d" % (cmd, code))