File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import process from 'process' ;
2-
1+ import process from 'node:process' ;
32import type { RpcMessage } from './types' ;
43
4+ function isClosedIpcChannelError ( error : unknown ) : boolean {
5+ if ( typeof error === 'object' && error !== null && 'code' in error ) {
6+ const CLOSED_IPC_ERROR_CODES = new Set ( [ 'ERR_IPC_CHANNEL_CLOSED' , 'EPIPE' ] ) ;
7+ return CLOSED_IPC_ERROR_CODES . has ( error . code as string ) ;
8+ }
9+ return false ;
10+ }
11+
512// eslint-disable-next-line @typescript-eslint/no-explicit-any
613export function exposeRpc ( fn : ( ...args : any [ ] ) => any ) {
714 const sendMessage = ( message : RpcMessage ) =>
@@ -50,6 +57,13 @@ export function exposeRpc(fn: (...args: any[]) => any) {
5057 } ) ;
5158 }
5259 } catch ( sendError ) {
60+ if ( isClosedIpcChannelError ( sendError ) ) {
61+ console . warn (
62+ '[type-check] Skipped because the parent process exited. Build may have failed or been interrupted.' ,
63+ ) ;
64+ return ;
65+ }
66+
5367 // we can't send things back to the parent process - let's use stdout to communicate error
5468 if ( error ) {
5569 console . error ( error ) ;
You can’t perform that action at this time.
0 commit comments