* Initiate the handshake and wait for a response from the parent.
()
| 176 | * Initiate the handshake and wait for a response from the parent. |
| 177 | */ |
| 178 | public async handshake(): Promise<DefaultedArgs> { |
| 179 | this.logger.debug("initiating handshake") |
| 180 | this.send({ type: "handshake" }) |
| 181 | const message = await onMessage<ParentMessage, ParentHandshakeMessage>( |
| 182 | process, |
| 183 | (message): message is ParentHandshakeMessage => { |
| 184 | return message.type === "handshake" |
| 185 | }, |
| 186 | this.logger, |
| 187 | ) |
| 188 | this.logger.debug( |
| 189 | "got message", |
| 190 | field("message", { |
| 191 | type: message.type, |
| 192 | args: redactArgs(message.args), |
| 193 | }), |
| 194 | ) |
| 195 | return message.args |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * Notify the parent process that it should relaunch the child. |
no test coverage detected