Skip to content

Commit ba53cd2

Browse files
committed
propagate --color and --startup-file options in julia_cmd
1 parent 351d7e9 commit ba53cd2

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

base/util.jl

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,16 @@ printstyled(msg...; bold::Bool=false, color::Union{Int,Symbol}=:normal) =
428428
Return a julia command similar to the one of the running process.
429429
Propagates any of the `--cpu-target`, `--sysimage`, `--compile`, `--sysimage-native-code`,
430430
`--compiled-modules`, `--inline`, `--check-bounds`, `--optimize`, `-g`,
431-
`--code-coverage`, and `--depwarn`
431+
`--code-coverage`, `--track-allocation`, `--color`, `--startup-file`, and `--depwarn`
432432
command line arguments that are not at their default values.
433433
434434
Among others, `--math-mode`, `--warn-overwrite`, and `--trace-compile` are notably not propagated currently.
435435
436436
!!! compat "Julia 1.1"
437437
Only the `--cpu-target`, `--sysimage`, `--depwarn`, `--compile` and `--check-bounds` flags were propagated before Julia 1.1.
438+
439+
!!! compat "Julia 1.5"
440+
The flags `--color` and `--startup-file` were added in Julia 1.5.
438441
"""
439442
function julia_cmd(julia=joinpath(Sys.BINDIR::String, julia_exename()))
440443
opts = JLOptions()
@@ -486,12 +489,18 @@ function julia_cmd(julia=joinpath(Sys.BINDIR::String, julia_exename()))
486489
isempty(coverage_file) || push!(addflags, "--code-coverage=$coverage_file")
487490
end
488491
end
489-
if opts.malloc_log != 0
490-
if opts.malloc_log == 1
491-
push!(addflags, "--track-allocation=user")
492-
elseif opts.malloc_log == 2
493-
push!(addflags, "--track-allocation=all")
494-
end
492+
if opts.malloc_log == 1
493+
push!(addflags, "--track-allocation=user")
494+
elseif opts.malloc_log == 2
495+
push!(addflags, "--track-allocation=all")
496+
end
497+
if opts.color == 1
498+
push!(addflags, "--color=yes")
499+
elseif opts.color == 2
500+
push!(addflags, "--color=no")
501+
end
502+
if opts.startupfile == 2
503+
push!(addflags, "--startup-file=no")
495504
end
496505
return `$julia -C$cpu_target -J$image_file $addflags`
497506
end

0 commit comments

Comments
 (0)