File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,11 +117,21 @@ impl ForgeCommandExecutorService {
117117 } else {
118118 let stdout_writer = OutputPrinterWriter :: stdout ( self . output_printer . clone ( ) ) ;
119119 let stderr_writer = OutputPrinterWriter :: stderr ( self . output_printer . clone ( ) ) ;
120- tokio:: try_join!(
120+ let result = tokio:: try_join!(
121121 child. wait( ) ,
122122 stream( & mut stdout_pipe, stdout_writer) ,
123123 stream( & mut stderr_pipe, stderr_writer)
124- ) ?
124+ ) ?;
125+
126+ // If the command's stdout did not end with a newline, the terminal
127+ // cursor is left mid-line. Write a newline so that subsequent output
128+ // (e.g. the LLM response) starts on a fresh line.
129+ if result. 1 . last ( ) != Some ( & b'\n' ) && !result. 1 . is_empty ( ) {
130+ let _ = self . output_printer . write ( b"\n " ) ;
131+ let _ = self . output_printer . flush ( ) ;
132+ }
133+
134+ result
125135 } ;
126136
127137 // Drop happens after `try_join` due to <https://github.com/tokio-rs/tokio/issues/4309>
You can’t perform that action at this time.
0 commit comments