File tree Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -287,20 +287,23 @@ async function patchelf(dest: vscode.Uri): Promise<void> {
287287 ` ;
288288 const origFile = vscode . Uri . file ( dest . fsPath + "-orig" ) ;
289289 await vscode . workspace . fs . rename ( dest , origFile , { overwrite : true } ) ;
290- progress . report ( { message : "Patching executable" , increment : 20 } ) ;
291- await new Promise ( ( resolve , reject ) => {
292- const handle = exec ( `nix-build -E - --argstr srcStr '${ origFile . fsPath } ' -o '${ dest . fsPath } '` ,
293- ( err , stdout , stderr ) => {
294- if ( err != null ) {
295- reject ( Error ( stderr ) ) ;
296- } else {
297- resolve ( stdout ) ;
298- }
299- } ) ;
300- handle . stdin ?. write ( expression ) ;
301- handle . stdin ?. end ( ) ;
302- } ) ;
303- await vscode . workspace . fs . delete ( origFile ) ;
290+ try {
291+ progress . report ( { message : "Patching executable" , increment : 20 } ) ;
292+ await new Promise ( ( resolve , reject ) => {
293+ const handle = exec ( `nix-build -E - --argstr srcStr '${ origFile . fsPath } ' -o '${ dest . fsPath } '` ,
294+ ( err , stdout , stderr ) => {
295+ if ( err != null ) {
296+ reject ( Error ( stderr ) ) ;
297+ } else {
298+ resolve ( stdout ) ;
299+ }
300+ } ) ;
301+ handle . stdin ?. write ( expression ) ;
302+ handle . stdin ?. end ( ) ;
303+ } ) ;
304+ } finally {
305+ await vscode . workspace . fs . delete ( origFile ) ;
306+ }
304307 }
305308 ) ;
306309}
You can’t perform that action at this time.
0 commit comments