Skip to content

Commit 5d96f84

Browse files
committed
chore: revert "fix(spin): pause tea before running the sub-process (#621)"
1 parent fb3191b commit 5d96f84

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

spin/spin.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,24 +60,27 @@ type finishCommandMsg struct {
6060
}
6161

6262
func commandStart(command []string) tea.Cmd {
63-
var args []string
64-
if len(command) > 1 {
65-
args = command[1:]
66-
}
63+
return func() tea.Msg {
64+
var args []string
65+
if len(command) > 1 {
66+
args = command[1:]
67+
}
68+
cmd := exec.Command(command[0], args...) //nolint:gosec
6769

68-
cmd := exec.Command(command[0], args...) //nolint:gosec
69-
if term.IsTerminal(os.Stdout.Fd()) {
70-
stdout := io.MultiWriter(&bothbuf, &errbuf)
71-
stderr := io.MultiWriter(&bothbuf, &outbuf)
70+
if term.IsTerminal(os.Stdout.Fd()) {
71+
stdout := io.MultiWriter(&bothbuf, &errbuf)
72+
stderr := io.MultiWriter(&bothbuf, &outbuf)
7273

73-
cmd.Stdout = stdout
74-
cmd.Stderr = stderr
75-
} else {
76-
cmd.Stdout = os.Stdout
77-
}
74+
cmd.Stdout = stdout
75+
cmd.Stderr = stderr
76+
} else {
77+
cmd.Stdout = os.Stdout
78+
}
79+
80+
_ = cmd.Run()
7881

79-
return tea.ExecProcess(cmd, func(error) tea.Msg {
8082
status := cmd.ProcessState.ExitCode()
83+
8184
if status == -1 {
8285
status = 1
8386
}
@@ -88,7 +91,7 @@ func commandStart(command []string) tea.Cmd {
8891
output: bothbuf.String(),
8992
status: status,
9093
}
91-
})
94+
}
9295
}
9396

9497
func (m model) Init() tea.Cmd {

0 commit comments

Comments
 (0)