File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ func run(cmd *cobra.Command, args []string) error {
139139 }
140140
141141 // 执行应用逻辑
142- output , err : = application .Run (input , stdin , flags )
142+ _ , err = application .Run (input , stdin , flags )
143143
144144 // 保存历史记录(即使执行失败也保存)
145145 if saveErr := hist .Save (historyPath ); saveErr != nil && flags .Verbose {
@@ -151,8 +151,8 @@ func run(cmd *cobra.Command, args []string) error {
151151 return err
152152 }
153153
154- // 输出结果
155- fmt . Print ( output )
154+ // 注意:输出已经在 ExecuteWithOutput 中通过 MultiWriter 实时显示了,
155+ // 这里不需要再次打印,否则会导致输出重复
156156
157157 return nil
158158}
@@ -309,7 +309,7 @@ func retryCommand(id int) error {
309309 application .SetHistory (hist )
310310
311311 // 执行命令(使用原始输入重新转换)
312- output , err : = application .Run (entry .Input , "" , flags )
312+ _ , err = application .Run (entry .Input , "" , flags )
313313
314314 // 保存历史记录
315315 if saveErr := hist .Save (historyPath ); saveErr != nil && flags .Verbose {
@@ -320,8 +320,7 @@ func retryCommand(id int) error {
320320 return err
321321 }
322322
323- // 输出结果
324- fmt .Print (output )
323+ // 注意:输出已经在 ExecuteWithOutput 中通过 MultiWriter 实时显示了
325324
326325 return nil
327326}
You can’t perform that action at this time.
0 commit comments