Skip to content

Commit

Permalink
fix(misconf): disable git terminal prompt on module load
Browse files Browse the repository at this point in the history
Signed-off-by: nikpivkin <[email protected]>
  • Loading branch information
nikpivkin committed Dec 2, 2024
1 parent a16270c commit 8afcff0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/iac/scanners/terraform/parser/resolvers/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ func (r *remoteResolver) download(ctx context.Context, opt Options, dst string)
return err
}

var opts []getter.ClientOption

// Overwrite the file getter so that a file will be copied
getter.Getters["file"] = &getter.FileGetter{Copy: true}

Expand All @@ -87,7 +85,13 @@ func (r *remoteResolver) download(ctx context.Context, opt Options, dst string)
Pwd: opt.WorkingDir,
Getters: getter.Getters,
Mode: getter.ClientModeAny,
Options: opts,
}

terminalPrompt := os.Getenv("GIT_TERMINAL_PROMPT")
if err := os.Setenv("GIT_TERMINAL_PROMPT", "0"); err != nil {
opt.Logger.Error("Failed to set env", log.String("name", "GIT_TERMINAL_PROMPT"), log.Err(err))
} else {
defer os.Setenv("GIT_TERMINAL_PROMPT", terminalPrompt)
}

if err := client.Get(); err != nil {
Expand Down

0 comments on commit 8afcff0

Please sign in to comment.