Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interrupt or error during callback causes terminal to not echo output #25

Closed
wch opened this issue Nov 21, 2017 · 1 comment · Fixed by #33
Closed

Interrupt or error during callback causes terminal to not echo output #25

wch opened this issue Nov 21, 2017 · 1 comment · Fixed by #33

Comments

@wch
Copy link
Member

wch commented Nov 21, 2017

If you run this code in a terminal, then press Ctrl-C before it finishes, then quit R, the terminal will no longer echo text that is typed. Running reset restores it to normal.

R
library(later)

later(function() {
  cat("start...")
  Sys.sleep(5)
  cat("done.\n")
})

However, catching the interrupt prevents the problem:

R
library(later)

later(function() {
  cat("start...")
  tryCatch({
    Sys.sleep(5)
  }, 
  interrupt = function(e) {
    cat("interrupt")
  })
  cat("done.\n")
})

Some more information about this type of problem: https://askubuntu.com/a/172747/131896

In itself, this isn't a big problem, but it makes me wonder if other things are not being cleaned up properly.

> sessioninfo::session_info()
─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.4.2 (2017-09-28)
 os       macOS High Sierra 10.13.1   
 system   x86_64, darwin15.6.0        
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       <NA>                        
 date     2017-11-21                  

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version    date       source                      
 clisymbols    1.2.0      2017-05-21 CRAN (R 3.4.0)              
 later       * 0.6.0.9000 2017-11-21 Github (r-lib/later@c1c3b09)
 Rcpp          0.12.13    2017-09-28 cran (@0.12.13)             
 sessioninfo   1.0.0      2017-06-21 CRAN (R 3.4.1)              
 withr         2.1.0      2017-11-01 CRAN (R 3.4.2)              
@wch
Copy link
Member Author

wch commented Nov 29, 2017

The same happens if there's an error in the callback:

later::later(function() {
  stop("asdf")
})

@wch wch mentioned this issue Nov 29, 2017
@wch wch changed the title Interrupt during callback causes terminal to not echo output Interrupt or error during callback causes terminal to not echo output Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant