File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,10 @@ func main() {
129129 Name : "background" ,
130130 Usage : "background the process and don't wait for it to complete" ,
131131 },
132+ cli.BoolFlag {
133+ Name : "pristine" ,
134+ Usage : "insert only the decrypted values into the environment without forwarding existing environment variables" ,
135+ },
132136 cli.StringFlag {
133137 Name : "user" ,
134138 Usage : "the user to run the command as" ,
@@ -163,6 +167,7 @@ func main() {
163167 Command : command ,
164168 Plaintext : output ,
165169 Background : c .Bool ("background" ),
170+ Pristine : c .Bool ("pristine" ),
166171 User : c .String ("user" ),
167172 }); err != nil {
168173 return toExitError (err )
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ type ExecOpts struct {
2121 Command string
2222 Plaintext []byte
2323 Background bool
24+ Pristine bool
2425 Fifo bool
2526 User string
2627 Filename string
@@ -83,7 +84,12 @@ func ExecWithEnv(opts ExecOpts) error {
8384 SwitchUser (opts .User )
8485 }
8586
86- env := os .Environ ()
87+ var env []string
88+
89+ if ! opts .Pristine {
90+ env = os .Environ ()
91+ }
92+
8793 lines := bytes .Split (opts .Plaintext , []byte ("\n " ))
8894 for _ , line := range lines {
8995 if len (line ) == 0 {
You can’t perform that action at this time.
0 commit comments