x11 - fork()/exec() in XWindow application -
How to execute xterm
from the XWindow program, insert it into my window, but both execute the execution Keep Xterm active and after closing it?
In my XWindows (XLib over XCB) application, I type xterm -Into & lt; Handle & gt; I want to execute
. Because there is a xterm
window in my window unfortunately something is going wrong.
Pseudo-code:
if (fork () == 0) {pipe = popan ('extram-in' handle); Whereas (pipe) becomes (pipe); Exit (0); }
I'm tired as system ()
and execvp ()
as well. Everything is fine till I exit bash
which runs in xterm
, my program goes out, I think the connection to the X server has been lost. Because it is shared between parent and child.
Update: The program is shown on the terminal after exit (or crash instead). "IO Error 11 (experimental temporarily unavailable)" on the X server: <"> After 59 requests (59 processed known) 1 with event balance. [Xcb] Processing queue Unknown sequence number [xcb] Maybe it is a multi-threaded client and XInitThreads is not called [xcb] aborting, sorry about it: Y: ../../src/xcb_io.cokia74: poll_for_event: Ascension The '! Xcb_xlib_threads_sequence_lost' failure is a possibility that you end up because the SIGCHLD signal is not ignored And it has been canceled
Reasons to abort your program .
is a sign (SIGCHLD, SIG_IGN);
Another is because you are suspicious of some actively closing the X session just off the socket There should not be any difference, but if you are using a library that registers an Antset call, there may be a problem with it
from your snippet Since the area, it seems that you do not really care about Stdaut the Akstram in a better way to do that would be to work closer to 0,1,2 FD. After this, it seems that after expiry of extram, you do not have to do anything in the baby's process, you can use 'Exme' instead of 'Execution', replacing the child's process completely. , Which includes cleaner handlers. Although, I'm not sure how you want to make your snippet, it clearly does not call 'it' that you want.
To ensure that the X connection is off, you can set the exec off on the exec scale with the following (this will work on the POSIX system where x connection numbers are the FD of the server socket)
fcntl (execonctionnumber (display), f_setfd, fcntl (exconnection number (display), f_getfd) | fdcolaexec; Also keep in mind that 'popen' is harvested in the background except for your thorn, I think that you might want to execvp there, then the waiting pump (..., WNOHANG ) To check the child's end in your main X11 loop, if you know it while you're out of it.
Comments
Post a Comment