Skip to content

Commit

Permalink
support clearing machine's command by passing an empty string (#4141)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangra authored Dec 30, 2024
1 parent c666349 commit 3a74f3f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions internal/command/machine/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,12 +699,18 @@ func determineMachineConfig(

if input.updating {
// Called from `update`. Command is specified by flag.
if command := flag.GetString(ctx, "command"); command != "" {
split, err := shlex.Split(command)
if err != nil {
return machineConf, errors.Wrap(err, "invalid command")
if flag.IsSpecified(ctx, "command") {
command := strings.TrimSpace(flag.GetString(ctx, "command"))
switch command {
case "":
machineConf.Init.Cmd = nil
default:
split, err := shlex.Split(command)
if err != nil {
return machineConf, errors.Wrap(err, "invalid command")
}
machineConf.Init.Cmd = split
}
machineConf.Init.Cmd = split
}
} else {
// Called from `run`. Command is specified by arguments.
Expand Down

0 comments on commit 3a74f3f

Please sign in to comment.