Reset REPL terminal mode to working/default settings

If I start the julia REPL on win10 and then use shell mode to run a cygwin program (e.g. bash or whatever) when I exit the cygwin program the REPL model prompt is messed up.

Is there a way to reset the REPL terminal (like ‘stty sane’ in POSIX)?

Here is an example session, starting with entering shell mode with “;” and then starting the cygwin bash.exe. The bash shell works but on exit the REPL terminal is corrupted.

julia>

shell> c:/cygwin64/bin/bash

me@mypc /cygdrive/c/Users/me/Desktop/projects $
exit

This should be the usual “julia>” prompt:

←[7C←[32m←[1mjulia> ←[0m←[0m

This should be a blank line since I just did a Enter by itself

←[?2004l

Here I’m typing “;” then “cmd”, then “Enter” which looks like this in the REPL terminal

←[10Cmd1m←[1mshell> ←[0m←[0m
←[?2004l←[0mMicrosoft Windows [Version 10.0.19041.572]
© 2020 Microsoft Corporation. All rights reserved.

C:\Users\me\Desktop\projects>exit

The good news is that apparently CMD escape doesn’t confuse the REPL terminal mode so things get back to nominal:

julia>

For reference, this is what the above sequence entering the shell mode to run CMD should and does look like when the REPL terminal is not confused:

shell> cmd
Microsoft Windows [Version 10.0.19041.572]
© 2020 Microsoft Corporation. All rights reserved.

C:\Users\chm\Desktop\projects>exit

julia>

This is of interest to me so that I can use cygwin functionality from the julia REPL and it seems that this may be the only issue with that capability working…

This came up lately, see this thread:

Sigh. I really did try searching the discourse and julia github issues for this…

Thanks for the hack around. :slight_smile:

Now I just need to get the PATH for the shell cmd set appropriately for using cygwin programs.

By adding C:\cygwin64\bin to my system PATH environment variable (at the end to avoid conflicts with windows programs) I am able use “;cmd /c bash” for a bash shell or “;cmd /c ls” to list the directory. Things are looking better. If I can add a keystroke shortcut or a default of some sort to prepend to the shell cmd generated it would be great.

Thanks for getting me on track!

On julia 1.6.1 the “;cmd /c” workaround is not needed. If you have the cygwin bin directory (e.g. C:\cygwin64\bin or whatever) in your PATH then everything seems to be working cleanly.

Also, if you wish to add your cygwin bin to the PATH for julia and the windows REPL it is simpler to add the appropriate command to your “.julia/config/startup.jl” file rather than having to use the windows system GUI which may not even be enabled for some administrative domains.