-
-
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
[WIP] REPL shell mode for windows #21294
Conversation
Update repl_cmd()
shell = shell_split(get(ENV,"JULIA_SHELL",get(ENV,"SHELL","/bin/sh"))) | ||
shell_name = Base.basename(shell[1]) | ||
function repl_cmd(line::AbstractString, out) | ||
if is_windows() |
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.
Should use @static
when conditioning on the OS inside a function
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.
not unless you're emitting code that doesn't compile on multiple platforms, or you really need to eliminate the comparison for runtime performance. better to leave the static out if neither is the case, have all branches at least get compiled.
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.
I think on v0.6, code is conditionally compiled with and without @static
So maybe there's no runtime performance difference?
Both test1()
and test2()
produce the same llvm:
test1() = is_windows() ? 1 : "a"
test2() = @static is_windows() ? 1 : "a"
julia> @code_llvm test1()
; Function Attrs: uwtable
define i64 @julia_test1_68517() #0 !dbg !5 {
top:
ret i64 1
}
julia> @code_llvm test2()
; Function Attrs: uwtable
define i64 @julia_test2_68518() #0 !dbg !5 {
top:
ret i64 1
}
Bump — would be nice to see this merged in some form. |
Replaced by #23703 |
Take 2 for #20776
(I made a mistake with GitHub when trying to modify that PR, sorry)
Summary:
JULIA_SHELL
can be set to:cmd
is default for Windows users.For Windows, the raw line is processed, rather than converting to
Cmd
and then re-assembling into a Windows command line. Windows shell commands are passed as a string anyway, so this gives the user more control over any escaping. I think it works quite well.Modified special handling of
cd
. When there are 2 or more arguments, command line is processed as normal, rather than throwing an error. This allows commands such ascd $dir && $command
to be executed.