Bug 16259 - COLUMNS can not be updated when the terminal window size is changed but a command is still running
Summary: COLUMNS can not be updated when the terminal window size is changed but a com...
Status: CLOSED INVALID
Alias: None
Product: R
Classification: Unclassified
Component: Low-level (show other bugs)
Version: R 3.1.2
Hardware: Other Other
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-03-14 14:16 UTC by pengyu.ut
Modified: 2015-03-16 09:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pengyu.ut 2015-03-14 14:16:21 UTC
See the following example. The environment variable COLUMNS can not be update correctly when the terminal window size is changed.

R> Sys.getenv('COLUMNS')
[1] "80"
R> Sys.sleep(5) # I changed the window size during this period of 10 seconds.
R> Sys.getenv('COLUMNS')
[1] "80"

But if I exit from the R session, I can see COLUMNS is changed in the bash shell from which R was called.

~$ echo $COLUMNS 
75
Comment 1 Peter Dalgaard 2015-03-16 09:25:01 UTC
That is because the shell usually manages it. E.g., on OS X, neither 'vi', 'emacs', 'less', or 'more' have COLUMNS in their environment, at least not in a user-accessible way. (Try :!env, M-x shell-command env, !env, !env, respectively).

It seems that an application program could potentially catch SIGWINCH and adjust settings accordingly, but I don't see a compelling use case for R to do this, and it may not be easy to get right. At any rate, it is not reasonable to count this as a bug in R.