File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,12 @@ export const test = base.extend<{
2424
2525 await use ( webcontainer ) ;
2626
27+ addEventListener ( "unhandledrejection" , ( event ) => {
28+ console . log ( "unhandled rejection" , {
29+ reason : event . reason ,
30+ type : event . type ,
31+ } ) ;
32+ } ) ;
2733 await webcontainer . teardown ( ) ;
2834 } ,
2935} ) ;
Original file line number Diff line number Diff line change 77export class WebContainer {
88 private _instancePromise ?: WebContainerApi ;
99 private _isReady : Promise < void > ;
10+ private _onExit : Promise < unknown > [ ] = [ ] ;
1011
1112 constructor ( ) {
1213 this . _isReady = WebContainerApi . boot ( { } ) . then ( ( instance ) => {
@@ -49,6 +50,8 @@ export class WebContainer {
4950 async teardown ( ) {
5051 this . _instance . teardown ( ) ;
5152 this . _instancePromise = undefined ;
53+
54+ await Promise . all ( this . _onExit ) ;
5255 }
5356
5457 async runCommand ( command : string , args : string [ ] = [ ] ) {
@@ -64,6 +67,8 @@ export class WebContainer {
6467 } ) ,
6568 ) ;
6669
70+ this . _onExit . push ( process . exit ) ;
71+
6772 await process . exit ;
6873
6974 return output . trim ( ) ;
You can’t perform that action at this time.
0 commit comments