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 () => {
59
59
60
60
await client . close ( ) ;
61
61
} ) ;
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 {
185
185
return this . _process ?. stderr ?? null ;
186
186
}
187
187
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
+
188
197
private processReadBuffer ( ) {
189
198
while ( true ) {
190
199
try {
You can’t perform that action at this time.
0 commit comments