Embedding konsole and other fun stories

I just spent few hours trying to embed konsole into kapture and get it’s pty device. I managed to do this, after some struggle and quite some mistakes (some of them on my part, some not all that much). Anyway, it’s now embedded and even runs programs when i ask it to. The problem now is, that it closes just after the program terminates :/. That’s unfortunate, as i thought that i’d run tty on it to find where should i redirect my fds. There is no such api in TerminalInterface to get at it. Surprise! Also, it took me some time to figure, that i have to pass program name (ie, argv[0]), as args[0]. Not even a word about this in documentation. Konsole keeps saying “Uh oh, can’t write data” or something along these lines if you don’t. Fun.

I’m back to figuring how to redirect my fds into konsole for now… I’ll let you know how this turned out ;).

Hmm, as i think of it, it might be easiest to just copy & paste parts of the libapt-pkg — dpkg interface and tweak it to run dpkg in konsole. But IIRC, code copying was evil last time i checked. Anyway, OOP was supposed to provide extensibility and flexibility, so that code could be reused in sane ways. Guess what. It doesn’t work :P. At least not 100% ;).