fix: change pid return type from undefined to be null
This commit is contained in:
parent
7e134f259e
commit
d154914db7
2 changed files with 9 additions and 4 deletions
|
|
@ -64,7 +64,7 @@ test("should return child process pid", async () => {
|
|||
const client = new StdioClientTransport(serverParameters);
|
||||
|
||||
await client.start();
|
||||
expect(client.pid).toBeDefined();
|
||||
expect(client.pid).not.toBeNull();
|
||||
await client.close();
|
||||
expect(client.pid).toBeUndefined();
|
||||
expect(client.pid).toBeNull();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -184,8 +184,13 @@ export class StdioClientTransport implements Transport {
|
|||
return this._process?.stderr ?? null;
|
||||
}
|
||||
|
||||
get pid(): number | undefined {
|
||||
return this._process?.pid;
|
||||
/**
|
||||
* The child process pid spawned by this transport.
|
||||
*
|
||||
* This is only available after the transport has been started.
|
||||
*/
|
||||
get pid(): number | null {
|
||||
return this._process?.pid ?? null;
|
||||
}
|
||||
|
||||
private processReadBuffer() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue