Merge "veyron/lib/testutil/integration: remove isValidShell check"
diff --git a/lib/testutil/integration/util.go b/lib/testutil/integration/util.go
index 82870e2..8f5b314 100644
--- a/lib/testutil/integration/util.go
+++ b/lib/testutil/integration/util.go
@@ -22,7 +22,6 @@
package integration
import (
- "bufio"
"bytes"
"fmt"
"io"
@@ -329,30 +328,6 @@
}
}
-// Tries to determine if the given shellPath represents a valid shell (i.e. is
-// present in /etc/shells).
-//
-// TODO(sjr): support platforms /etc/shells doesn't exist (e.g. windows).
-func isValidShell(shellPath string) bool {
- f, err := os.Open("/etc/shells")
- if err != nil {
- return false
- }
- r := bufio.NewReader(f)
- for {
- var path string
- if path, err = r.ReadString('\n'); err != nil {
- break
- }
-
- if strings.TrimSpace(path) == shellPath {
- return true
- }
- }
-
- return false
-}
-
func (e *integrationTestEnvironment) DebugShell() {
// Get the current working directory.
cwd, err := os.Getwd()
@@ -387,13 +362,11 @@
shellPath := "/bin/sh"
if shellPathFromEnv := os.Getenv("SHELL"); shellPathFromEnv != "" {
- if isValidShell(shellPathFromEnv) {
- shellPath = shellPathFromEnv
- }
+ shellPath = shellPathFromEnv
}
proc, err := os.StartProcess(shellPath, []string{}, &attr)
if err != nil {
- e.t.Fatalf("StartProcess(%v) failed: %v", shellPath, err)
+ e.t.Fatalf("StartProcess(%q) failed: %v", shellPath, err)
}
// Wait until user exits the shell