Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions cmd/sops/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
}
Expand All @@ -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",
Expand Down Expand Up @@ -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)
}
Expand Down
17 changes: 4 additions & 13 deletions cmd/sops/subcommand/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down