lib/modules: change the NewShell factory to take a security.Principal arg.
- NewShell now takes a Principal as an argument and allows the
created shell and its subprocesses to share that principal. Taking
this a parameter allows the shell to be used with the runtime's
in-memory Principal when required or with any other.
Change-Id: Ib2dc07fdc4edf1c23afed9b37661eb484f56717e
diff --git a/tools/naming/simulator/driver.go b/tools/naming/simulator/driver.go
index 7826391..01685f9 100644
--- a/tools/naming/simulator/driver.go
+++ b/tools/naming/simulator/driver.go
@@ -108,7 +108,11 @@
return
}
- shell := modules.NewShell()
+ shell, err := modules.NewShell(nil)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "unexpected error: %s\n", err)
+ os.Exit(1)
+ }
defer shell.Cleanup(os.Stderr, os.Stderr)
scanner := bufio.NewScanner(os.Stdin)
diff --git a/tools/naming/simulator/driver_test.go b/tools/naming/simulator/driver_test.go
index d4dac88..5ccb5cb 100644
--- a/tools/naming/simulator/driver_test.go
+++ b/tools/naming/simulator/driver_test.go
@@ -40,7 +40,10 @@
}
func TestVariables(t *testing.T) {
- sh := modules.NewShell()
+ sh, err := modules.NewShell(nil)
+ if err != nil {
+ t.Fatalf("unexpected error: %s", err)
+ }
sh.SetVar("foo", "bar")
cases := []struct {
input string
diff --git a/tools/servicerunner/main.go b/tools/servicerunner/main.go
index 861592c..2e8560e 100644
--- a/tools/servicerunner/main.go
+++ b/tools/servicerunner/main.go
@@ -64,7 +64,10 @@
vars := map[string]string{}
- sh := modules.NewShell()
+ sh, err := modules.NewShell(nil)
+ if err != nil {
+ panic(fmt.Sprintf("modules.NewShell: %s", err))
+ }
defer sh.Cleanup(os.Stderr, os.Stderr)
v, ok := sh.GetVar(consts.VeyronCredentials)
if !ok {