@@ -80,8 +80,6 @@ function getOptionsWithDefaults(o?: OutputProgressOptions) {
80
80
} ;
81
81
}
82
82
83
- class BuildAndRunException extends Error { }
84
-
85
83
export function listenCommandWithOutputAndProgress ( command : CommandToSpawn , options ?: OutputProgressOptions , input ?: string ) : Thenable < void > {
86
84
const settings = vscode . workspace . getConfiguration ( SETTINGS_NAME ) ;
87
85
const outputFlushPeriod = settings . get ( "outputFlushPeriod" , 500 ) as number ;
@@ -91,8 +89,7 @@ export function listenCommandWithOutputAndProgress(command: CommandToSpawn, opti
91
89
const opt = getOptionsWithDefaults ( options ) ;
92
90
93
91
const output = getOutputChannel ( ) ;
94
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
- let outputBuffer : any [ ] = [ ] ;
92
+ let outputBuffer : Uint8Array [ ] [ ] = [ ] ;
96
93
let outputText = "" ;
97
94
let outputFile : WriteStream | null = null ;
98
95
let hadIllegalChars = false ;
@@ -106,7 +103,7 @@ export function listenCommandWithOutputAndProgress(command: CommandToSpawn, opti
106
103
}
107
104
bufferString = bufferString . replaceAll ( '\0' , "\\0" ) ;
108
105
109
- if ( outputText . length + bufferString . length <= MAX_OUTPUT_VIEW_SIZE ) {
106
+ if ( outputFile === null && outputText . length + bufferString . length <= MAX_OUTPUT_VIEW_SIZE ) {
110
107
output . append ( bufferString ) ;
111
108
outputText += bufferString ;
112
109
} else {
@@ -124,7 +121,9 @@ export function listenCommandWithOutputAndProgress(command: CommandToSpawn, opti
124
121
output . append ( "\nFULL OUTPUT IN file:///" + outputFilePath ) ;
125
122
}
126
123
}
127
- outputFile . write ( bufferString ) ;
124
+ for ( const chunk of outputBuffer ) {
125
+ outputFile . write ( chunk ) ;
126
+ }
128
127
}
129
128
outputBuffer = [ ] ;
130
129
} ;
@@ -133,7 +132,7 @@ export function listenCommandWithOutputAndProgress(command: CommandToSpawn, opti
133
132
location : vscode . ProgressLocation . Window ,
134
133
cancellable : true
135
134
} , ( progress , token ) => {
136
- return new Promise ( ( resolve , reject ) => {
135
+ return new Promise ( ( resolve ) => {
137
136
token . onCancellationRequested ( ( ) => {
138
137
if ( child )
139
138
killCommand ( child ) ;
@@ -163,7 +162,7 @@ export function listenCommandWithOutputAndProgress(command: CommandToSpawn, opti
163
162
if ( code || signal ) {
164
163
const exitCode = ( code ? code : signal ) ;
165
164
output . append ( opt . failureMsg ( endTime - startTime , exitCode ) ) ;
166
- reject ( new BuildAndRunException ( ) ) ;
165
+ resolve ( ) ;
167
166
} else {
168
167
output . append ( opt . successMsg ( endTime - startTime ) ) ;
169
168
resolve ( ) ;
@@ -174,8 +173,7 @@ export function listenCommandWithOutputAndProgress(command: CommandToSpawn, opti
174
173
}
175
174
} , input ) ;
176
175
177
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
178
- const outHandler = ( data : any ) => {
176
+ const outHandler = ( data : Uint8Array [ ] ) => {
179
177
outputBuffer . push ( data ) ;
180
178
} ;
181
179
0 commit comments