File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -59,3 +59,12 @@ test("should read messages", async () => {
5959
6060 await client . close ( ) ;
6161} ) ;
62+
63+ test ( "should return child process pid" , async ( ) => {
64+ const client = new StdioClientTransport ( serverParameters ) ;
65+
66+ await client . start ( ) ;
67+ expect ( client . pid ) . not . toBeNull ( ) ;
68+ await client . close ( ) ;
69+ expect ( client . pid ) . toBeNull ( ) ;
70+ } ) ;
Original file line number Diff line number Diff line change @@ -185,6 +185,15 @@ export class StdioClientTransport implements Transport {
185185 return this . _process ?. stderr ?? null ;
186186 }
187187
188+ /**
189+ * The child process pid spawned by this transport.
190+ *
191+ * This is only available after the transport has been started.
192+ */
193+ get pid ( ) : number | null {
194+ return this . _process ?. pid ?? null ;
195+ }
196+
188197 private processReadBuffer ( ) {
189198 while ( true ) {
190199 try {
You can’t perform that action at this time.
0 commit comments