GNOME Bugzilla – Bug 622478
Anjuta vte plugin fails if vte_terminal_fork_command fails
Last modified: 2010-06-25 05:59:14 UTC
Hi, all Anjuta is now using vte as its terminal plugin. But when calling ianjuta_terminal_execute_command, if the command execution fails, the launched vte terminal will enter an keyboard/mouse unresponse state. If I tried to go on with executing the second/third valid command, the terminal will be bring back. I guess it is because when executing invalid command, the vte termial got no output stream and be blocked in reading? Anyway, If the command execution fails, we'd better print the error information on the terminal, instead of being UI un-responsive, is it? related anjuta bugzilla link https://bugzilla.gnome.org/show_bug.cgi?id=619253 Thanks a lot for your help! criping
Can you elaborate on what you mean by 'unresponsive'? If you mean that if executing the command fails, the terminal just does nothing, that's expected and not a bug. If on the other hand it means that vte hangs the containing programme, or consumes CPU, then that would be a bug. Also, what's the exact error returned? Use vte_terminal_fork_command_full() and pass it a non-NULL GError. Got a link to the anjuta code that's doing this?
(In reply to comment #1) > Can you elaborate on what you mean by 'unresponsive'? If you mean that if > executing the command fails, the terminal just does nothing, that's expected > and not a bug. If on the other hand it means that vte hangs the containing > programme, or consumes CPU, then that would be a bug. > > Also, what's the exact error returned? Use vte_terminal_fork_command_full() and > pass it a non-NULL GError. > > Got a link to the anjuta code that's doing this? Hi, Thanks a lot for help! Unresponsive means the terminal has no output and no command prompt. It is blank. User can't input anything on the terminal too. So terminal is there yet we could do nothing with it. I ran into this problem in anjuta2.28 and anjuta 2.30 is the same. We call anjuta/plugins/terminal/terminal.c->terminal_execute to call local cross gdb. But if local cross gdb does not exsit, we'll ran into above problem. We thought better behavior would be the terminal with command prompt there, and even give some error message. I saw terminal_execute will call vte_terminal_fork_command and get chile_pid. I remember I did some tests before. If fails, the Child_pid will be -1? Yet I don't know how to deal with vte unresponsive problem. I think vte is not dead of course. Because if a call terminal_execute again for a "pwd", it will becomes just good again. I report this problem to anjuta team, but they said I should report here. Are above behavior the expected behavior for the vte? paster anjuta code http://git.gnome.org/browse/anjuta/tree/plugins/terminal/terminal.c line 415 for your ref. Thanks& Regards, criping
A few code comments: term_plugin->child_pid = vte_terminal_fork_command (term, args[0], args, environment, dir, term_plugin->lastlog, term_plugin->update_records, term_plugin->update_records); vte_reaper_add_child (term_plugin->child_pid); Missing error check before vte_reaper_add_child, which is redundant anyway since vte_terminal_fork_command does that internally already. vte_terminal_fork_command (term, shell, NULL, NULL, dir, term_plugin->lastlog, term_plugin->update_records, term_plugin->update_records); } No error check whatsoever. --- This is all as expected. If launching the command fails (fork_command returns -1, or fork_command_full returns FALSE), then the terminal has no input and no output, since nothing is running on it.
Hi, thanks for point it out. Yes, I also found the problem and made a patch for it. But that didn't help just as you said that terminal has no input and output. So user just can't do operations on the terminal. Just a quick question here: if execution fails, could it be possible to write a "\n" or did any other things to the terminal so that terminal could be brought back? So that user experiences might be good. we also find if we execute local gdb. The gdb first output (lots of version informations, etc) will be messed up in 2.30 anjuta. We'll try to identify the reason of vte terminal output and give details here. Thanks a lot for your help! criping
If fork fails, you can try forking a shell. It's up to you to tell vte what to do next.
(In reply to comment #5) > If fork fails, you can try forking a shell. It's up to you to tell vte what to > do next. Thanks for the information. I will turn back to anjuta plugin community to solve the problem.