Get process id of process spawned via PTY.spawn


i am spawning a longer running process via PTY.spawn (inside of a thread
actually) and printing its output. But i need the process id of the
spawned process in order to kill it on strg+c. The id i get in the
parameters of the block that i pass to PTY.spawn is not the same id as
the id i can see when doing ps aux | grep mycmd. How do i get hold of
the process id?