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

Fix #9103, implementing cd - in REPL shell mode #9192

Merged
merged 4 commits into from
Dec 15, 2014

Conversation

garrison
Copy link
Member

No description provided.

@garrison
Copy link
Member Author

The AppVeyor build failed when attempting to connect to status.julialang.org:443. Is there any way to re-trigger it?

@tkelman
Copy link
Contributor

tkelman commented Nov 29, 2014

I restarted it for you. Would be nice to add a test for the new functionality, not sure if/where we have any tests of shell mode right now. Maybe test/repl.jl ?

@tkelman tkelman added the REPL Julia's REPL (Read Eval Print Loop) label Nov 29, 2014
@garrison
Copy link
Member Author

OK, I made some tests (and I am waiting to see if they work on Windows), but running them displays the new directories to STDOUT it seems.

$ make && make test-repl
    JULIA test/repl
     * repl
/tmp/tmp7qjvvg
/home/garrison/julia/test
/home/garrison
    SUCCESS

Perhaps the call to println() in repl_cmd() should really be writing to a file handle, not STDOUT? This call existed before I made the change in this pull request, though.

@Keno
Copy link
Member

Keno commented Nov 29, 2014

Yes, quite likely that call should write to the REPL's stream.

write(stdin_write, "cd $(tmpdir)\n")
readuntil(stdout_read, "\n")
readuntil(stdout_read, "\n")
@assert pwd() != origpwd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use @test, not @assert here

@garrison
Copy link
Member Author

At this point it works on UNIX-like systems. The Windows test hangs, however, waiting on the REPL to print back the directory after changing directory. I have no way myself of debugging this further.

@garrison
Copy link
Member Author

To be clear on the status: cd - now works in the shell mode on UNIX, and likely works on Windows. It no longer println's the new directory name to STDOUT, but instead to the output stream of the REPL, which is better for testing. I added tests for the cd shell-mode functionality to test/repl.jl. These tests work on UNIX but hang on Windows. It almost certainly hangs waiting for the directory cd'ed to to be output by the REPL (perhaps a variation on the directory name is instead given? or perhaps it is a CRLF issue, since the current test expects a newline to come immediately after the new directory.).

@tkelman
Copy link
Contributor

tkelman commented Nov 30, 2014

@dhoegh would you be willing/able to help debug the windows side of this?

@@ -60,6 +60,33 @@ write(stdin_write, '\x03')
write(stdin_write, "\\alpha\t")
readuntil(stdout_read,"α")
write(stdin_write, '\x03')
# Test cd feature in shell mode
origpwd = pwd()
tmpdir = mktempdir()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be changed to tmpdir = escape_string(mktempdir()) due to no escaption takes place when you write to stdin_write. This effects windows path due to it uses backslashes, but it also effects linux if there is spaces in the path.

@tkelman
Copy link
Contributor

tkelman commented Dec 1, 2014

Looks like this is passing on win32 now, but would there be any way to avoid the WARNING: readuntil(IO,AbstractString) will perform poorly with a long string? That could get a bit annoying, the existing warnings that we get while running the tests have already confused people, would like to avoid adding any more if we can.

@garrison
Copy link
Member Author

@tkelman I fixed the warning by looking for at most 40 characters when calling readuntil().
All tests now pass, and I believe this is ready to be merged.

@tkelman
Copy link
Contributor

tkelman commented Dec 14, 2014

Great, looks good to me. If no objections or other feedback I think this should be good to merge.

tkelman added a commit that referenced this pull request Dec 15, 2014
Fix #9103, implementing `cd -` in REPL shell mode
@tkelman tkelman merged commit 3ff5870 into JuliaLang:master Dec 15, 2014
@tkelman
Copy link
Contributor

tkelman commented Dec 15, 2014

Thanks for the contribution @garrison!

@garrison
Copy link
Member Author

Thank you too, @tkelman!

@garrison garrison deleted the repl_oldpwd branch December 15, 2014 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants