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

Add warning to Pkg.update() if updated modules were already imported #18239

Closed
stevengj opened this issue Aug 25, 2016 · 2 comments
Closed

Add warning to Pkg.update() if updated modules were already imported #18239

stevengj opened this issue Aug 25, 2016 · 2 comments
Labels
modules packages Package management and loading

Comments

@stevengj
Copy link
Member

If you do Pkg.update(), it should keep track of whether it updates any modules that were already imported into Main. If so, it should print a warning message telling the user that they will need to restart Julia if they want to use the updated modules.

Should be pretty easy to implement. (I would prefer that we don't print the warning unconditionally, e.g. if no imported modules were updated.)

See also #18150, cc @vtjnash.

@stevengj stevengj added the packages Package management and loading label Aug 25, 2016
@helgee
Copy link
Contributor

helgee commented Aug 25, 2016

Like this?

pkgsym = Symbol(pkg)
if isdefined(Main, pkgsym) && typeof(getfield(Main, pkgsym)) == Module
    warn("Package $pkg has been updated but it was already imported.")
    warn("Restart Julia to use the updated version.")
end

@stevengj
Copy link
Member Author

stevengj commented Aug 25, 2016

@helgee, yes, something like that. Note that you'll want to call warn only once (you can pass it a multi-line string). You can use isa(x, Foo) rather than typeof(x) == Foo.

helgee added a commit to helgee/julia that referenced this issue Aug 26, 2016
helgee added a commit to helgee/julia that referenced this issue Sep 7, 2016
Add test for JuliaLang#18248.

Remove redundant loop.

Refactor test.

Wrap line.
@tkelman tkelman closed this as completed in 424b3c5 Sep 8, 2016
tkelman pushed a commit that referenced this issue Feb 22, 2017
Add test for #18248.

Remove redundant loop.

Refactor test.

Wrap line.
(cherry picked from commit 424b3c5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules packages Package management and loading
Projects
None yet
Development

No branches or pull requests

3 participants