-
-
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
Use PowerShell for REPL shell mode on Windows #16565
Comments
Dup of #7267 ? |
No, this is a different thing. What I'm suggesting here is that command entered in REPL mode of the julia shell (i.e. after you have pressed |
It is however contained in #11478. I think it would be better to do this as a package rather than making it default, since there's a substantial initial latency in running powershell commands. |
Yes, #11478 has some discussion, but it really is a PR about something else, so might make sense to keep this issue here open? I agree performance will not be good if you start powershell.exe whenever you execute a command via |
I don't think we're likely to move much more functionality from packages into base, we're doing a lot of the reverse. |
If it's useful enough (and it probably would be for doing a more capable version of |
Did some more research on how this might be done. I think the easiest might be this: create a dll written in C# that interacts with the PowerShell hosting API. That dll would then export native functions via the UnmanagedExports package and could be called directly from julia via ccall. I just tried this and it all works. That seems by far the simplest way to get the whole CLR hosting etc. done, essentially one just gets that for free with this approach. |
"on Windows". Note, PowerShell is now portable to Linux and OS X. I guess it doesn't change this issue as can't depend on it installed.. |
Have there been any updates on this? I use Julia on Windows and it would be nice to use Powershell commands on the REPL in shell mode. |
We don't use a shell in any of the "shell" modes, so I'm inclined to say no on this. |
Could you elaborate? I'm not quite familiar as to how shell mode works on the REPL. I just mean that just as we can use bash commands in shell mode running the REPL on Linux, is there no way to be able to use PS commands in shell mode on the REPL as well? Edit: I guess I should clarify, it's not important to me that I can specifically use PS commands in shell mode. It would be perfectly ok to use bash commands. But the problem seems to be that when running the Julia REPL from Powershell, none of the usual commands work in shell mode (ls, pwd, cd, tec...) |
Has anyone tried if they work in git-bash? |
You can’t use bash commands on Linux: shell mode is not a shell, it’s just a syntax for doing |
I was referring to things like
|
I think we can close this with Windows Terminal being out. |
I don't think this issue here has anything to do with the Windows Terminal: it is about the experience one gets in the |
Yes, it has nothing to do with the Windows Terminal. The request is for the shell mode on Windows to run an actual shell, unlike what it currently does on all platforms. I really don't think we want to get into the game of shell mode invoking real shells, but if we do, then it should be the same on all platforms and not different on Windows. |
I guess this goes back to me not understanding how shell mode works, so I don't think I'm articulating this properly. It doesn't matter (to me) that shell more doesn't run an actual shell. It matters that when I run the Julia REPL from Windows Terminal, shell mode doesn't work (running |
One option would be to ship (bundle) busybox along with Julia on Windows and include the path to busybox in the path (probably at the end of the path) in shell mode so that commands like that do actually work. Busybox is GPL, but this this is bundling rather than creating a derived work—if you delete busybox, everything still works and you could swap in any implementation of the same commands to the same effect. |
I think if we ever wanted to support PowerShell in the way I asked for at the top (and I should say, I don't think this is a high priority issue), then today one could also think about something like this:
That way this problem would be outsourced from Julia itself. Could we reopen this issue? Even if it isn't high priority, I think it is a valid request and maybe at some point someone wants to take it up. I think a distinct issue is that shell mode on Windows right now is just more or less useless, but fixing that (in a non-PowerShell way) seems a topic for a different issue than this one here. |
These approaches aren't mutually exclusive: shipping busybox would make the shell mode on Windows not useless by default and would make many examples in the wild work on Windows. Allowing packages to hook into the shell mode is also a cool idea, but we could do both. |
Yes, agreed, I think doing both would be ideal. Fixing shell mode (via busybox or whatever) seems the higher priority to me of the two. |
I see the difference. Yes, it would be nice that it drops you into something meaningful, when you press |
[EDIT: I assumed same solution as for BusyBox would work for Toybox, but it's not been ported, and WSL only may (or may not) work: https://github.com/landley/toybox/issues/61 ]
As you say the GPL not a problem, but I would suggest the much smaller 814 KB (archived):
If we ever support Android, then it's already there. Both boxes are for Unix (and KornShell Android uses), so I wouldn't know if they work on Windows, I guess the solution works for both. |
Since UNIX systems already have all the expected commands, we only need this for Windows, so something that doesn't appear to work on Windows isn't super helpful. |
Just as a practical workaround for the time being, it is possible to use |
I use msys2 as shell for julia. It works as expected. Or just use rust alternatives as lsd, fd, ripgrep... Just put them on path and you will have a shell working. |
It would be great if the julia shell mode on Windows used PowerShell as the shell. That is after all the default shell on Windows, and it is much more powerful cmd.exe.
This has some info on how to host PowerShell. Not sure how one would pull this of technically, maybe have a mixed DLL that is compiled with VC as a bridge between julia and the CLR?
Clearly not a high priority item.
The text was updated successfully, but these errors were encountered: