File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ export class NativeUltraHonkBackend {
2828 targetDir ,
2929 `${ circuitHash } _${ witnessHash } _proof` ,
3030 ) ;
31+ fs . mkdirSync ( proofOutputPath , { recursive : true } ) ;
3132
3233 fs . writeFileSync ( circuitJsonPath , JSON . stringify ( this . circuit ) ) ;
3334 fs . writeFileSync ( witnessOutputPath , witness ) ;
@@ -54,7 +55,7 @@ export class NativeUltraHonkBackend {
5455 console . error ( `stderr: ${ data } ` ) ;
5556 } ) ;
5657
57- return await new Promise < ProofData > ( ( resolve , reject ) => {
58+ const promise = new Promise < ProofData > ( ( resolve , reject ) => {
5859 bbProcess . on ( "close" , ( code : number ) => {
5960 if ( code !== 0 ) {
6061 reject ( new Error ( `Process exited with code ${ code } ` ) ) ;
@@ -67,6 +68,12 @@ export class NativeUltraHonkBackend {
6768 reject ( new Error ( `Failed to start process: ${ err . message } ` ) ) ;
6869 } ) ;
6970 } ) ;
71+ try {
72+ return await promise ;
73+ } finally {
74+ fs . rmSync ( proofOutputPath , { recursive : true } ) ;
75+ fs . rmSync ( witnessOutputPath , { recursive : true } ) ;
76+ }
7077 }
7178
7279 async #getCircuitHash( ) {
You can’t perform that action at this time.
0 commit comments