At some point we hardcoded bash as the BgJob default class,
but that artificially restricts us in embedded environments
with busybox, for example. So let's try to use bash, but
if we can't just default to /bin/sh.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/common_lib/base_utils.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/client/common_lib/base_utils.py b/client/common_lib/base_utils.py
index dfd1d92..f29556f 100644
--- a/client/common_lib/base_utils.py
+++ b/client/common_lib/base_utils.py
@@ -74,10 +74,15 @@ class BgJob(object):
 
         if verbose:
             logging.debug("Running '%s'" % command)
+        # Ok, bash is nice and everything, but we might face occasions where
+        # it is not available. Just do the right thing and point to /bin/sh.
+        shell = '/bin/bash'
+        if not os.path.isfile(shell):
+            shell = '/bin/sh'
         self.sp = subprocess.Popen(command, stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE,
                                    preexec_fn=self._reset_sigpipe, shell=True,
-                                   executable="/bin/bash",
+                                   executable=shell,
                                    stdin=stdin)
 
 
-- 
1.7.7.6

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to