Revert "lib/modules: Pass credentials irrespective of "ExecProtocol"."
This reverts commit a72e70b4c45f109c6c9a434fd40131faa75b9eb8.
This change was incomplete.
Specifically, v.io/x/ref/lib/modules/exec.go does not pass in the connection to the agent to the subprocess if ExecProtocol is false.
It should be able to do that, I think. But I'll revisit that later.
Change-Id: Ib434900117b962e9262be8b7721ea0e2f5bf1fab
diff --git a/lib/modules/shell.go b/lib/modules/shell.go
index 9965aae..eec1e8e 100644
--- a/lib/modules/shell.go
+++ b/lib/modules/shell.go
@@ -277,7 +277,7 @@
return fd, nil
}
-// NewCustomCredentials creates a new Principal for StartWithOpts.
+// NewCustomCredentials creates a new Principal for StartWithCredentials.
// Returns nil if the shell is not managing principals.
func (sh *Shell) NewCustomCredentials() (cred *CustomCredentials, err error) {
// Create child principal.
@@ -505,10 +505,12 @@
}
var p *os.File
- if opts.Credentials != nil {
- p, err = opts.Credentials.File()
- if err != nil {
- return nil, err
+ if opts.ExecProtocol {
+ if opts.Credentials != nil {
+ p, err = opts.Credentials.File()
+ if err != nil {
+ return nil, err
+ }
}
}