Hi guys,
during my joyful experience with qt, i encountered a problems that it seems doesn't want to be handled! :
I have some (external) console commands that I want to write some GUI for them. when running in a terminal like Konsole, these programs output sequence is :
stderr (prints help message)
stdout (asks what operation I would like to do usually using a menu)
stdin (waiting for my input)
as in
$somecmd
welcome to this program ......... (stderr)
you can use this program this way "somecmd -[dfr] " (stderr)
what do you want to do? (stdout)
1 open a file (stdout)
2 write a file (stdout)
3 exit (stdout)
(stdin waiting for input)
$somecmd
welcome to this program ......... (stderr)
you can use this program this way "somecmd -[dfr] " (stderr)
what do you want to do? (stdout)
1 open a file (stdout)
2 write a file (stdout)
3 exit (stdout)
(stdin waiting for input)
To copy to clipboard, switch view to plain text mode
in konsole or xterm everything is fine, but when using qprocess I can not get the menu which is shot out through stdout. So in the GUI, after running program, it prints its stderr messages and without printing stdout menu, is waiting for input. I have tried various methods (merged channels, using DupStderr in q3process, using pipes, ...) but never could have stdout messages which comes before stdin. if I closeWriteChannel() in slot which reads stderr, the menu is printed but this time I dont have accessibility to stdin and program continues using its defaults.
I think the matter is opening stdin closes stdout channel(which seems reasonable) but how can I have those buffered stdouts? Do you know how konsole or other emulators manage this? Do I need to subclass qprocess? Defining child processes may be helpful? how?
Any help, hint or suggestion is quite appreciated.
Bookmarks