File tree Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Expand file tree Collapse file tree 1 file changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -60,24 +60,27 @@ type finishCommandMsg struct {
60
60
}
61
61
62
62
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
67
69
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 )
72
73
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 ()
78
81
79
- return tea .ExecProcess (cmd , func (error ) tea.Msg {
80
82
status := cmd .ProcessState .ExitCode ()
83
+
81
84
if status == - 1 {
82
85
status = 1
83
86
}
@@ -88,7 +91,7 @@ func commandStart(command []string) tea.Cmd {
88
91
output : bothbuf .String (),
89
92
status : status ,
90
93
}
91
- })
94
+ }
92
95
}
93
96
94
97
func (m model ) Init () tea.Cmd {
You can’t perform that action at this time.
0 commit comments