octave 3.8.1 can't stop execution in gui command window - user-interface

I'm running octave 3.8 with the gui in Ubuntu 14.04. I have an infinite loop somewhere in my program and it seems like the terminal doesn't respond to the typical keypresses to stop execution. (eg. Ctrl+C, Ctrl+Z) When I run programs in the terminal, I can just press Ctrl+C, but that doesn't seem to work here. What can I do to halt execution?

To stop a running command or script in octave GUI or prompt:
Ctrl+C
you will see:
less -- (f)orward, (b)ack, (q)uit
To abort (and close the GUI or command line):
Control+C
To just stop printing the output of the command or script (?):
q
Enter

It's a long-running bug that hasn't been fixed since 2012, run with --no-gui if possible.

after going through lots of bugs report and all.
Finally by hitting (ctr + c + Enter) at command window (below the pause statment) execution gets terminated.
hope it works for u too.

Related

Break the current program without exiting VIM

When using VIM, I usually like to run programs by using the bang in command mode.
That is, use
:!<external shell command>
to test code without exiting vim or alt-tabbing to another open shell. So for example, when writing Java code, I might do something like
:!java Main
Or in C, maybe
:!cls & gcc -g -o main Program.c File.c & main
This works fine. The VIM window turns into a shell, my program runs, and then upon exit I get back into VIM.
The issue is when my program hits an infinite loop. I get stuck with the terminal displaying the standard output and then I can't get back to VIM. Control-C exits EVERYTHING and then I need to re-open VIM and re-open all my files and it's a big mess (especially if I didn't save something!).
tl;dr Is there a way to stop internally-running externally-defined shell commands in VIM?
In my case, Ctrl-c works just fine.
I am on vim 7.4 on ubuntu 14.04.
Control-z works instead of Control-c

Sending signal to bash shell launched in GVim

How do I send a signal (say, SIGINT), to a shell launched inside GVim, using a keyboard shortcut?
Neither Ctrl+C nor Ctrl+D seem to work.
Ctrl+D seems to work for me, at least for closing a terminal session. Crl+C however does not. If you only want to kill a running process, you can do this workaround (provided Ctrl+Z) works for you.
Press Ctrl+Z to pause the process, then
kill %1
to kill the process in the background.
Inside vim, use command :shto temporarily exit vim and go to shell
If you want to go back to vim then press Ctrl + D. This work for me for years.

Is there a way to revert back to the command line after opening an application through it?

I want to be able to open an application on the command line, but instead of switching to the application, I want to stay on my terminal emulator. Is there a way of accomplishing this? I am using OS X.
Use the -g flag of open, which avoids bringing the app to the foreground.
$ open -g /Applications/TextEdit.app
$
open will start the app, and then return to the command prompt.
After you run the program hit ctrl+z and type bg. You will return to your terminal CLI.
Whenever you want to go back to your program, just type fg.
You can background the job. In the Bash shell, this is done with the &. For example:
some_script_or_application &
Note that some daemons and processes background themselves. For example, on OS X, running open some.pdf will preview the PDF in a GUI while returning the command prompt immediately without needing to do anything special.
See the GNU Bash Manual for more on job control for background jobs.

how to close geany terminal

Whenever a program finishes to run when executing it with geany, the terminal doesn't close.
geany terminal waits for a keystroke to close. How do I change this behavior and make it close automatically when the program reaches it's end? Is there a script I can write?
This is not really an answer, but more like an alternative suggestion. In newer versions of Geany you can tell it to run programs in the Vitual Terminal Emulation, i.e. the terminal tab at the bottom (Settings -> Terminal -> Run Programs in VTE).
This way, the program starts more quickly (without first starting a terminal), you can still see the output generated by the program (exception stacktraces!), and the focus/cursor stays in the editor window, too.
I actually found a way of doing what you want to do in the terminal instead of using Geany's VTE. The perk of that is that you can run multiple scripts at the same time (or a single one multiple times), while the VTE only executes one script at the time (at least that's the case for me).
Just go to Build -> Set Build Commands. The last type of options says "Execute commands". The standard option is python "%f".
Just add && exit so that it reads
python "%f" && exit.
That way the terminal window will close instantly once it's finished if the programm doesn't give you an error code. If it does, the error message will be displayed and the window is kept open.
A variant of pohly's answer worked for me:
In Build -> Set Build Commands -> Execute commands
I replaced "./%e" by "./%e" && exit
better this way, let the terminal to stay for a moment so that we could see the results in case you want to
python "%f" && sleep 20 && exit

darcs help breaks my shell

I have just installed darcs 2.1.2.2. When I type darcs help, sth less-like shows up. When I dismiss it with q it goes away but I don't get prompt and can't execute any commands. C-c doesn't work either. I am using bash on gentoo.
I have no idea what darcs is, but when bash fails to return to the prompt that some command as part of a pipeline is still running. For instance if you ran:
cmd | less
And exited less, but cmd did not die from a broken pipe, then cmd would continue to run and bash would continue to wait until it exited. It also might not respond to signals and keypresses if it didn't have access to the tty.
You will need a second terminal to check and see if any processes are hanging around after trying to dismiss darcs. Sometimes Ctrl-Z or Ctrl-\ will work where Ctrl-C doesn't. There is probably no fix other than to look at darcs and figure out why it is not dimissing like it should. If it is really launching less, then maybe typing ">" before "q" will make it exit properly.
In this situation (terminal messed up, can't see what you're typing) the "reset" command will often fix things.
I would try again with a newer darcs, eg version 2.3 released today. If the problem still happens, you can probably change this behaviour - see the darcs manual. Otherwise, folks on the #darcs irc channel will be able to help.

Resources