Question

When my program gets to this line:

pid_t nPid = forkpty( &m_nMasterFD, NULL, NULL, NULL );

Outputs this:

X Error: BadIDChoice (invalid resource ID chosen for this connection) 14
  Extension:    148 (RENDER)
  Minor opcode: 17 (RenderCreateGlyphSet)
  Resource id:  0x3600002
<unknown>: Fatal IO error 4 (Interrupted system call) on X server :0.0.

And terminates. As you can see, I'm trying to make a pty to run stuff in, but it's not working.

Also, is there a way forkpty() can be called within a class? ( I tried both ways, but neither worked. )

I'm programming in QT C++ on Ubuntu 9.10.

EDIT: Here's a link to the question with the code that finally worked for me.

Was it helpful?

Solution

forkpty() forks your process. You need to close the filedescriptors first, in particular the connection to the X server in your child process. This means you likely cannot use forkpty , but have to use openpty(), fork(),close filedescriptors in the child process, logintty/()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top