File tree 2 files changed +7
-0
lines changed 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import {processConsoleLine} from './RepoActionView.vue';
4
4
5
5
test ( 'processConsoleLine' , ( ) => {
6
6
expect ( processConsoleLine ( 'abc' ) ) . toEqual ( 'abc' ) ;
7
+ expect ( processConsoleLine ( 'abc\n' ) ) . toEqual ( 'abc' ) ;
8
+ expect ( processConsoleLine ( 'abc\r\n' ) ) . toEqual ( 'abc' ) ;
7
9
expect ( processConsoleLine ( '\r' ) ) . toEqual ( '' ) ;
8
10
expect ( processConsoleLine ( '\rx\rabc' ) ) . toEqual ( 'abc' ) ;
9
11
expect ( processConsoleLine ( '\rabc\rx\r' ) ) . toEqual ( 'xbc' ) ;
Original file line number Diff line number Diff line change @@ -308,6 +308,11 @@ export function initRepositoryActionView() {
308
308
}
309
309
310
310
export function processConsoleLine (line ) {
311
+ if (line .endsWith (' \r\n ' )) {
312
+ line = line .substring (0 , line .length - 2 );
313
+ } else if (line .endsWith (' \n ' )) {
314
+ line = line .substring (0 , line .length - 1 );
315
+ }
311
316
if (! line .includes (' \r ' )) return line;
312
317
313
318
// handle "\rReading...1%\rReading...5%\rReading...100%", only show the final message
You can’t perform that action at this time.
0 commit comments