-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix Base.isinteractive() for startup files #42507
Conversation
Could you explain this a bit more? |
@KristofferC You can add something like this to the startup file: shell> cat ~/.julia/config/startup.jl
try PyPlot.plt.interactive(Base.isinteractive()) catch ; end
System image is build using using PackageCompiler
create_sysimage([:PyPlot]; sysimage_path="sys_PyPlot.so") ... and the $ ./julia -J sys_PyPlot.so -q
julia> using PyPlot
julia> plt.isinteractive()
true Alternative would be to use Xref: JuliaPy/PyPlot.jl#476 |
base/client.jl
Outdated
@@ -299,9 +302,7 @@ function exec_options(opts) | |||
end | |||
repl |= is_interactive::Bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this could be moved higher as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repl
is only a local variable and seems not to have any effect before because it is always used as repl || is_interactive::Bool
. So I moved it to the following if
statement to simplify the code slightly.
Thanks, looks good to me. |
Co-authored-by: Jeff Bezanson <[email protected]>
This PR aims to fix #10779 by deciding whether the session is interactive before the startup file is executed. PR also enables hot-fix to set interactivity for
PyPlot
in the startup file when usingPackageCompiler
, see #42425.Before PR:
After this PR: