A while ago I discovered that you can make QtCreator call external tools directly from within the IDE and pass various arguments to those via the Tool->External. I find this pretty convenient however I’m currently struggling with the issue of starting a terminal-based application in an interactive bash. I am using Lubuntu 12.04 with QtCreator 2.5.2.
Usually you can start a new interactive bash with a specific application running in it by writing something like
$ bash -i -c some_command
with -i being the argument for interactive mode and -c telling bash to read the string that follows as some command/commands.
The dialog for configuration of external tools in QtCreator has two fields that omho are important in my case – Executable and Arguments. The first one points at the tool that you want to launch and the second allows you to start it with a bunch of arguments. However this seems not to be working! I’m trying to add htop (an advanced terminal-based task manager) along with other useful tools. However following problem occurs when trying to use bash:
For
Executable: bash Arguments: -i -c htop
I get
Starting external tool ‘/bin/bash’ -i -c htop
bash: no job control in this shell
Error opening terminal: unknown.
‘/bin/bash’ finished
For
Executable: bash Arguments: htop
Starting external tool ‘/bin/bash’ htop
/usr/bin/htop: /usr/bin/htop: cannot execute binary file
‘/bin/bash’ finished
which is perfectly normal as an error message since the -c argument is exactly what is needed to start htop in a new bash.
The funny thing is that using xterm (which is also the default external terminal for QtCreator (even though I didn’t have it on my system at first -_-) works like a charm. If I use the following settings for my htop-tool
Executable: xterm Arguments: -e htop
it opens a perfectly working, interactive htop in an external window running xterm.
Does anyone have any idea how to replace xterm with bash or is it just that I’m missing something? I’ve set my bash pretty nicely (even if I didn’t the default fonts and font size along with the absence of tabs in xterm should be a big enough reason not to use it unless one wants to configure it manually) and really want to use it. I’ve also tried looking at the documentation of QtCreator and the external tool XML files but was unable to find enough information to solve my problem.
Advertisement
Answer
xterm is a terminal emulator while Bash is a shell. You need a terminal emulator to run a shell or other text-based applications interactively in a graphical environment.
It sounds like you have a shortcut to a predefined terminal emulator starting Bash. I would suggest finding out which terminal emulator that is (maybe LXTerminal?) and using that terminal emulator to run htop
:
Executable: LXTerminal Arguments: -e htop
Read about the -e
option in the man page (your version’s documentation may vary).