File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -168,10 +168,11 @@ export async function preview(
168168 } ,
169169 }
170170
171- const closeServerAndExit = async ( ) => {
171+ const closeServerAndExit = async ( _ : unknown , exitCode ?: number ) => {
172172 try {
173173 await server . close ( )
174174 } finally {
175+ process . exitCode ??= exitCode ? 128 + exitCode : undefined
175176 process . exit ( )
176177 }
177178 }
Original file line number Diff line number Diff line change @@ -729,10 +729,11 @@ export async function _createServer(
729729 } ,
730730 } )
731731
732- const closeServerAndExit = async ( ) => {
732+ const closeServerAndExit = async ( _ : unknown , exitCode ?: number ) => {
733733 try {
734734 await server . close ( )
735735 } finally {
736+ process . exitCode ??= exitCode ? 128 + exitCode : undefined
736737 process . exit ( )
737738 }
738739 }
Original file line number Diff line number Diff line change @@ -1524,15 +1524,17 @@ export function partialEncodeURIPath(uri: string): string {
15241524 return filePath . replaceAll ( '%' , '%25' ) + postfix
15251525}
15261526
1527- export const setupSIGTERMListener = ( callback : ( ) => Promise < void > ) : void => {
1527+ export const setupSIGTERMListener = (
1528+ callback : ( signal ?: 'SIGTERM' , exitCode ?: number ) => Promise < void > ,
1529+ ) : void => {
15281530 process . once ( 'SIGTERM' , callback )
15291531 if ( process . env . CI !== 'true' ) {
15301532 process . stdin . on ( 'end' , callback )
15311533 }
15321534}
15331535
15341536export const teardownSIGTERMListener = (
1535- callback : ( ) => Promise < void > ,
1537+ callback : Parameters < typeof setupSIGTERMListener > [ 0 ] ,
15361538) : void => {
15371539 process . off ( 'SIGTERM' , callback )
15381540 if ( process . env . CI !== 'true' ) {
You can’t perform that action at this time.
0 commit comments