Skip to content

Commit

Permalink
add review suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Pulak Kanti Bhowmick <[email protected]>
  • Loading branch information
pkbhowmick committed Nov 5, 2024
1 parent a6dc100 commit affe284
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions internal/exec/shell_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func execTerraformShellCommand(
componentEnvList = append(componentEnvList, fmt.Sprintf("TF_CLI_ARGS_import=-var-file=%s", varFile))
componentEnvList = append(componentEnvList, fmt.Sprintf("TF_CLI_ARGS_destroy=-var-file=%s", varFile))
componentEnvList = append(componentEnvList, fmt.Sprintf("TF_CLI_ARGS_console=-var-file=%s", varFile))
componentEnvList = append(componentEnvList, "PS1=atmos>")
componentEnvList = append(componentEnvList, fmt.Sprintf("PS1=[atmos:%s/%s]> ", stack, component))

u.LogDebug(cliConfig, "\nStarting a new interactive shell where you can execute all native Terraform commands (type 'exit' to go back)")
u.LogDebug(cliConfig, fmt.Sprintf("Component: %s\n", component))
Expand Down Expand Up @@ -184,9 +184,15 @@ func execTerraformShellCommand(
if len(shellCommand) == 0 {
bashPath, err := exec.LookPath("bash")
if err != nil {
return err
// Try fallback to sh if bash is not available
shPath, shErr := exec.LookPath("sh")
if shErr != nil {
return fmt.Errorf("no suitable shell found: %v", shErr)
}
shellCommand = shPath
} else {
shellCommand = bashPath
}
shellCommand = bashPath
}
}

Expand Down

0 comments on commit affe284

Please sign in to comment.