Skip to content

Commit 6a9f6d4

Browse files
committed
gate the dump on terminal interactivity instead of CI env
1 parent d19b54a commit 6a9f6d4

3 files changed

Lines changed: 6 additions & 31 deletions

File tree

cmd/lk/simulate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func runSimulate(ctx context.Context, cmd *cli.Command) error {
369369
}
370370

371371
func isInteractive() bool {
372-
if util.InCI() {
372+
if os.Getenv("CI") != "" {
373373
return false
374374
}
375375
return isatty.IsTerminal(os.Stdin.Fd()) && isatty.IsTerminal(os.Stdout.Fd())

cmd/lk/simulate_ci.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import (
2626

2727
"github.com/livekit/protocol/livekit"
2828
agent "github.com/livekit/protocol/livekit/agent"
29-
30-
"github.com/livekit/livekit-cli/v2/pkg/util"
3129
)
3230

3331
type toggleWriter struct {
@@ -175,12 +173,12 @@ func runSimulateCI(ctx context.Context, config *simulateConfig) error {
175173

176174
// --- Results ---
177175

178-
if util.InCI() {
176+
if !out.Interactive() {
179177
report.Results(run, agent)
180178
} else {
181-
// This path also serves humans whose stdin/stdout merely isn't a TTY
182-
// (pipes, task runners): keep the terminal to counts and pointers,
183-
// the per-scenario transcripts go to a report file like the TUI's.
179+
// A terminal is watching; we just couldn't open the TUI (e.g. stdin
180+
// isn't a TTY). Keep it to counts and pointers, the per-scenario
181+
// transcripts go to a report file like the TUI's.
184182
if f, err := os.CreateTemp("", "lk-simulate-report-*.txt"); err == nil {
185183
writeRunResults(asciiWriter{f}, run, agent)
186184
f.Close()
@@ -201,7 +199,7 @@ func runSimulateCI(ctx context.Context, config *simulateConfig) error {
201199
_, _, _, failed := simulationJobCounts(run)
202200
if failed > 0 || run.Status == livekit.SimulationRun_STATUS_FAILED {
203201
errPrefix := ""
204-
if util.InCI() {
202+
if !out.Interactive() {
205203
errPrefix = "::error::"
206204
}
207205
if failed > 0 {

pkg/util/env.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)