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

package startup message not shown when build and reload #1442

Closed
dracodoc opened this issue Jan 18, 2017 · 7 comments
Closed

package startup message not shown when build and reload #1442

dracodoc opened this issue Jan 18, 2017 · 7 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@dracodoc
Copy link

Steps to reproduce

  1. create a package
  2. edit zzz.R in /R folder with
.onAttach <- function(libname, pkgname) {
  packageStartupMessage("test")
}
  1. build and reload. There is a message of "test" when package was loaded.
  2. build and reload again, no more messages no matter how many times build and reload, or load package manually again.
  3. manually restart R session with ctrl-shift-F10, then build and reload, message appear again.
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936  LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] message_0.1.0

loaded via a namespace (and not attached):
[1] tools_3.3.2

devtools version: 1.12.0.900

@hadley
Copy link
Member

hadley commented Aug 1, 2017

Build and reload is an RStudio function that installs the package, restarts R, and then calls library(). I'm surprised that something is going wrong here, but I see the issue too.

@kevinushey @jjallaire could you please take a look?

@jjallaire
Copy link
Collaborator

I do know that we have some purposeful suppression of output at startup on build and reload (I don't recall why). However, the fact that this occurs sometimes but not others makes me think it's not a case of eating the output on purpose.

@kevinushey
Copy link
Contributor

I'll try and see if I can figure out what's going on.

@dracodoc
Copy link
Author

dracodoc commented Aug 1, 2017

The fact that manual restart R session works make me wonder if the build and reload function called .rs.restartR(), but that function didn't do these two things according to this

  • Data from current session is removed
  • Packages from current session are unloaded

It's probably not this simple, since I don't think packages are not unloaded, which is part of the whole purpose.

I didn't find the code of the build and reload function so I can only guess this much.

@hadley hadley added the bug an unexpected problem or unintended behavior label Aug 1, 2017
@kevinushey
Copy link
Contributor

I see the same issue all the way back to RStudio v0.98.1091 (didn't test anything older, though) so this appears to be a long-standing issue.

@hadley
Copy link
Member

hadley commented Aug 2, 2017

I'm going to close this, and leave in the hands of the IDE team

@hadley hadley closed this as completed Aug 2, 2017
@lock
Copy link

lock bot commented Sep 18, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants