From eca174b0514cb5e6fc98ecf80fa1a6f2ca3752b9 Mon Sep 17 00:00:00 2001 From: Alex Ostapenko Date: Tue, 11 Feb 2020 22:07:19 +0100 Subject: [PATCH] Fix #629 : removing --background flag for exec-env and exec-file --- cmd/sops/main.go | 24 +++++++----------------- cmd/sops/subcommand/exec/exec.go | 17 ++++------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/cmd/sops/main.go b/cmd/sops/main.go index 4171f0fbc..6149c028c 100644 --- a/cmd/sops/main.go +++ b/cmd/sops/main.go @@ -111,10 +111,6 @@ func main() { Usage: "execute a command with decrypted values inserted into the environment", ArgsUsage: "[file to decrypt] [command to run]", Flags: append([]cli.Flag{ - cli.BoolFlag{ - Name: "background", - Usage: "background the process and don't wait for it to complete", - }, cli.StringFlag{ Name: "user", Usage: "the user to run the command as", @@ -146,10 +142,9 @@ func main() { } if err := exec.ExecWithEnv(exec.ExecOpts{ - Command: command, - Plaintext: output, - Background: c.Bool("background"), - User: c.String("user"), + Command: command, + Plaintext: output, + User: c.String("user"), }); err != nil { return toExitError(err) } @@ -162,10 +157,6 @@ func main() { Usage: "execute a command with the decrypted contents as a temporary file", ArgsUsage: "[file to decrypt] [command to run]", Flags: append([]cli.Flag{ - cli.BoolFlag{ - Name: "background", - Usage: "background the process and don't wait for it to complete", - }, cli.BoolFlag{ Name: "no-fifo", Usage: "use a regular file instead of a fifo to temporarily hold the decrypted contents", @@ -202,11 +193,10 @@ func main() { } if err := exec.ExecWithFile(exec.ExecOpts{ - Command: command, - Plaintext: output, - Background: c.Bool("background"), - Fifo: !c.Bool("no-fifo"), - User: c.String("user"), + Command: command, + Plaintext: output, + Fifo: !c.Bool("no-fifo"), + User: c.String("user"), }); err != nil { return toExitError(err) } diff --git a/cmd/sops/subcommand/exec/exec.go b/cmd/sops/subcommand/exec/exec.go index 95f135d79..89ad09ada 100644 --- a/cmd/sops/subcommand/exec/exec.go +++ b/cmd/sops/subcommand/exec/exec.go @@ -19,11 +19,10 @@ func init() { } type ExecOpts struct { - Command string - Plaintext []byte - Background bool - Fifo bool - User string + Command string + Plaintext []byte + Fifo bool + User string } func GetFile(dir string) *os.File { @@ -67,10 +66,6 @@ func ExecWithFile(opts ExecOpts) error { cmd := BuildCommand(placeholdered) cmd.Env = os.Environ() - if opts.Background { - return cmd.Start() - } - cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr @@ -98,10 +93,6 @@ func ExecWithEnv(opts ExecOpts) error { cmd := BuildCommand(opts.Command) cmd.Env = env - if opts.Background { - return cmd.Start() - } - cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr