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

option to force isinteractive=true at startup #6765

Closed
stevengj opened this issue May 6, 2014 · 6 comments
Closed

option to force isinteractive=true at startup #6765

stevengj opened this issue May 6, 2014 · 6 comments

Comments

@stevengj
Copy link
Member

stevengj commented May 6, 2014

Currently, isinteractive() returns false in IJulia (JuliaLang/IJulia.jl#173), and there is no way to change this because it is controlled by the Base.is_interactive global, which can't be changed outside of Base.

It might be good to have a way to force is_interactive=true by a command-line flag when Julia is started. You want to do this at startup, I think, because ideally it should be set before load_juliarc() is called.

@tknopp
Copy link
Contributor

tknopp commented May 6, 2014

Yes this would be nice. I also observed this when working on Julietta.jl and implementing a Gtk-based terminal.

@JeffBezanson
Copy link
Member

Might be too much to hope for, but it would be nice to get rid of isinteractive. I'm not sure there are any really compelling uses. It would be better to check more specific conditions, like whether stdin is a TTY. IJulia is a good example: ultimately there is an interactive user, but the process isn't set up that way.

@tknopp
Copy link
Contributor

tknopp commented May 6, 2014

One use case I have is when I want to run a Gtk.jl application script. In non-interactive mode one has to add wait(Condition()) at the end of the script so that julia does keep running. When running from the REPL this is not really wanted (see JuliaGraphics/Gtk.jl#38)

I usually put

if(!isinteractive())
    wait(Condition())
end

at the end of my Gtk.jl applications

@simonster
Copy link
Member

As a temporary solution, can't you do:

eval(Base, :(is_interactive = true))

@tknopp
Copy link
Contributor

tknopp commented May 6, 2014

seems to work.

@stevengj
Copy link
Member Author

stevengj commented May 6, 2014

Right, that works. But it might still be nice to have this for the .juliarc via a julia -i option (ala bash), e.g. I can imagine a user who wants to set up her .juliarc so that certain packages (e.g. for plotting) are automatically used in interactive mode.

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.

4 participants