File tree 3 files changed +8
-4
lines changed
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -168,10 +168,11 @@ export async function preview(
168
168
} ,
169
169
}
170
170
171
- const closeServerAndExit = async ( ) => {
171
+ const closeServerAndExit = async ( _ : unknown , exitCode ?: number ) => {
172
172
try {
173
173
await server . close ( )
174
174
} finally {
175
+ process . exitCode ??= exitCode ? 128 + exitCode : undefined
175
176
process . exit ( )
176
177
}
177
178
}
Original file line number Diff line number Diff line change @@ -729,10 +729,11 @@ export async function _createServer(
729
729
} ,
730
730
} )
731
731
732
- const closeServerAndExit = async ( ) => {
732
+ const closeServerAndExit = async ( _ : unknown , exitCode ?: number ) => {
733
733
try {
734
734
await server . close ( )
735
735
} finally {
736
+ process . exitCode ??= exitCode ? 128 + exitCode : undefined
736
737
process . exit ( )
737
738
}
738
739
}
Original file line number Diff line number Diff line change @@ -1524,15 +1524,17 @@ export function partialEncodeURIPath(uri: string): string {
1524
1524
return filePath . replaceAll ( '%' , '%25' ) + postfix
1525
1525
}
1526
1526
1527
- export const setupSIGTERMListener = ( callback : ( ) => Promise < void > ) : void => {
1527
+ export const setupSIGTERMListener = (
1528
+ callback : ( signal ?: 'SIGTERM' , exitCode ?: number ) => Promise < void > ,
1529
+ ) : void => {
1528
1530
process . once ( 'SIGTERM' , callback )
1529
1531
if ( process . env . CI !== 'true' ) {
1530
1532
process . stdin . on ( 'end' , callback )
1531
1533
}
1532
1534
}
1533
1535
1534
1536
export const teardownSIGTERMListener = (
1535
- callback : ( ) => Promise < void > ,
1537
+ callback : Parameters < typeof setupSIGTERMListener > [ 0 ] ,
1536
1538
) : void => {
1537
1539
process . off ( 'SIGTERM' , callback )
1538
1540
if ( process . env . CI !== 'true' ) {
You can’t perform that action at this time.
0 commit comments