Skip to content

Commit 926b9a4

Browse files
committed
Pass along pid and ppid
1 parent 71c1e24 commit 926b9a4

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/exports/api.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
2828
if (socketPath) {
2929
this.ipc = new IpcServer(socketPath)
3030
this.ipc.listen()
31-
this.outputChannel.appendLine(`IPC server started: ${socketPath}`)
31+
32+
this.outputChannel.appendLine(
33+
`IPC server started: socketPath=${socketPath}, pid=${process.pid}, ppid=${process.ppid}`,
34+
)
3235

3336
this.ipc.on(IpcMessageType.TaskCommand, async (_clientId, { commandName, data }) => {
3437
switch (commandName) {

src/exports/ipc.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ export class IpcServer extends EventEmitter<IpcServerEvents> {
5050
const clientId = crypto.randomBytes(6).toString("hex")
5151
this._clients.set(clientId, socket)
5252
this.log(`[server#onConnect] clientId = ${clientId}, # clients = ${this._clients.size}`)
53-
this.send(socket, { type: IpcMessageType.Ack, origin: IpcOrigin.Server, data: { clientId } })
53+
54+
this.send(socket, {
55+
type: IpcMessageType.Ack,
56+
origin: IpcOrigin.Server,
57+
data: { clientId, pid: process.pid, ppid: process.ppid },
58+
})
59+
5460
this.emit(IpcMessageType.Connect, clientId)
5561
}
5662

src/schemas/ipc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const ipcMessageSchema = z.discriminatedUnion("type", [
9494
z.object({
9595
type: z.literal(IpcMessageType.Ack),
9696
origin: z.literal(IpcOrigin.Server),
97-
data: z.object({ clientId: z.string() }),
97+
data: z.object({ clientId: z.string(), pid: z.number(), ppid: z.number() }),
9898
}),
9999
z.object({
100100
type: z.literal(IpcMessageType.TaskCommand),

0 commit comments

Comments
 (0)