File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ async function cpSingleFileToInstance(
210210
211211 return new Promise ( ( resolve , reject ) => {
212212 let settled = false ;
213+ let fileStream : fs . ReadStream | null = null ;
213214
214215 const doResolve = ( ) => {
215216 if ( ! settled ) {
@@ -221,6 +222,11 @@ async function cpSingleFileToInstance(
221222 const doReject = ( err : Error ) => {
222223 if ( ! settled ) {
223224 settled = true ;
225+ // Clean up file stream if open
226+ if ( fileStream ) {
227+ fileStream . destroy ( ) ;
228+ fileStream = null ;
229+ }
224230 reject ( err ) ;
225231 }
226232 } ;
@@ -240,7 +246,7 @@ async function cpSingleFileToInstance(
240246 ws . send ( JSON . stringify ( { type : 'end' } ) ) ;
241247 } else {
242248 // Stream file content
243- const fileStream = fs . createReadStream ( opts . srcPath , {
249+ fileStream = fs . createReadStream ( opts . srcPath , {
244250 highWaterMark : 32 * 1024 ,
245251 } ) ;
246252
You can’t perform that action at this time.
0 commit comments