如何从XWindow程序执行xterm
,将其插入到我的窗口中,但在xterm处于活动状态并关闭后两者都继续执行?XWindow应用程序中的fork()/ exec()
在我的XWindows(XLib over XCB)应用程序中,我想执行xterm -Into <handle>
。这样我的窗口就包含了xterm
窗口。不幸的是发生了一些错误。
伪代码:
if (fork() == 0) {
pipe = popen('xterm -Into ' + handle);
while (feof(pipe)) gets(pipe);
exit(0);
}
我累system()
和execvp()
为好。在我退出运行的xterm
之前,每件事情都可以,然后我的程序退出。我猜想与X服务器的连接会丢失,因为它是在父和子之间共享的。
更新:这里是程序退出后(或者说崩溃)在终端上显示的内容。
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
after 59 requests (59 known processed) with 1 events remaining.
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
y: ../../src/xcb_io.c:274: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted