GNU Screen Copy mode blocks execution?

11

3

I use GNU Screen's scrollback/copy mode. So I hit Control-A [ to enter copy mode, scroll up to the section I care about... and then I forget.

However, it seems like leaving GNU screen in scrollback/copy mode blocks execution of (whatever app was up at the time). For example, if I fire up a local webserver if I'm in scrollback/copy mode, then requests made to that web server will time out: the process doesn't respond until I exit copy/scrollback mode.

I've seen this both in Ruby On Rails script/server and with the Python tool Paste.

I've considered turning on logging mode for my windows, then just tailing/grepping through those logfiles as an alternative, but if this can be controlled by another means (setting, activating copy mode a different way) I'm very interested.

My screen -version says:

Screen version 4.00.03 (FAU) 23-Oct-06

(I asked this on quora.com, but maybe this is a better place)

RyanWilcox

Posted 2010-12-09T13:47:15.810

Reputation: 323

Answers

7

The reason that your processes are blocking is because screen will block the output pipe of the process while you are in copy paste mode. I don't see it as really being a bug, since realistically you are asking screen to store a potentially unlimited amount of information in its buffer while you are copy/pasting. If you want to have output of a program pass by, but also be able to pause it once in a while, try this.

program > logfile 2>&1 & 
less logfile

The 2>&1 will combine stderr and stdout from your program. The & sends the program into the background. Use fg to bring it to the foreground if you need. Now press F to follow the end of the logfile as it grows with less. Press ctrl+c if you need to stop and examine something, then F to follow again. You can also press & to limit the visible lines in less to a regular expression. Very handy when going through log files.

jmh

Posted 2010-12-09T13:47:15.810

Reputation: 191

"screen will block the output pipe of the process while you are in copy paste mode" - this might be true once a certain amount of output has been generated, but it doesn't seem to be true in this case: while ((1)) ; do echo $i; i=$((i+1)); sleep 0.1; done - try invoking Copy mode and wait a bit. When you exit copy mode, the value of i will have jumped, showing that execution continued in the background.

Yet I have seen screen block output for some processes, so I'm curious as to what exactly determines whether screen blocks or not. – davidA – 2018-02-02T01:28:24.383

"what exactly determines whether screen blocks or not" - the size of scrollback buffer determines it. You can increase it to be unlimited, but this will take memory. But will not block. – san – 2018-03-31T09:10:46.897