Skip to content

Commit

Permalink
Fix Nokia runner (#414)
Browse files Browse the repository at this point in the history
Nokia uses a custom runner internally. This internal runner was never
called, because ntt's run command registered as soon as environment
variable K3_40_RUN_POLICY was not set.

This commit fixes the condition and make improves its readability to
prevent similar issues in the future.
  • Loading branch information
5nord authored Feb 17, 2022
1 parent d33bd87 commit 638d35d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion cmd/ntt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,24 @@ func init() {
rootCmd.AddCommand(tags.Command)
rootCmd.AddCommand(report.Command)

if exe, _ := exec.LookPath("k3-run"); exe == "" || os.Getenv("K3_40_RUN_POLICY") != "old" {
useNokiaRunner := func() bool {
if s, ok := os.LookupEnv("K3_40_RUN_POLICY"); ok {
if s == "ntt" {
return false
}
return true
}
if exe, _ := exec.LookPath("k3-run"); exe != "" {
return true
}
if exe, _ := exec.LookPath("ntt-run"); exe != "" {
return true
}
return false

}

if !useNokiaRunner() {
rootCmd.AddCommand(run.Command)
}

Expand Down

0 comments on commit 638d35d

Please sign in to comment.