Skip to content

Commit b8b30a8

Browse files
authored
Use Base.active_project. (#1576)
1 parent e976e7b commit b8b30a8

File tree

5 files changed

+5
-21
lines changed

5 files changed

+5
-21
lines changed

docs/src/tutorials/common.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# function to run a Julia script outside of the current environment
22
function script(code; wrapper=``, args=``)
3-
if Base.JLOptions().project != C_NULL
4-
args = `$args --project=$(unsafe_string(Base.JLOptions().project))`
5-
end
63
mktemp() do path, io
74
write(io, code)
85
flush(io)
9-
cmd = `$wrapper $(Base.julia_cmd()) $args $path`
6+
cmd = `$wrapper $(Base.julia_cmd()) --project=$(Base.active_project()) $args $path`
107
# redirect stderr to stdout to have it picked up by Weave.jl
118
run(pipeline(ignorestatus(cmd), stderr=stdout))
129
end

perf/latency.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ using BenchmarkTools
66
function main()
77
results = BenchmarkGroup()
88

9-
base_cmd = Base.julia_cmd()
10-
if Base.JLOptions().project != C_NULL
11-
base_cmd = `$base_cmd --project=$(unsafe_string(Base.JLOptions().project))`
12-
end
9+
base_cmd = `$(Base.julia_cmd()) --project=$(Base.active_project())`
1310

1411
# make sure all artifacts are downloaded
1512
CUDA.version()

src/utilities.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,7 @@ Run a new Julia session under the CUDA compute-sanitizer tool `tool`. This is us
108108
detect various GPU-related issues, like memory errors or race conditions.
109109
"""
110110
function run_compute_sanitizer(julia_args=``; tool::String="memcheck", sanitizer_args=``)
111-
cmd = Base.julia_cmd()
112-
113-
# propagate --project
114-
if Base.JLOptions().project != C_NULL
115-
push!(cmd.exec, "--project=$(unsafe_string(Base.JLOptions().project))")
116-
end
111+
cmd = `$(Base.julia_cmd()) --project=$(Base.active_project())`
117112

118113
println("Re-starting your active Julia session...")
119114
run(`$(CUDA.compute_sanitizer_cmd(tool)) $sanitizer_args $cmd $julia_args`)

test/runtests.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,7 @@ end
226226
push!(test_exeflags.exec, "--check-bounds=yes")
227227
push!(test_exeflags.exec, "--startup-file=no")
228228
push!(test_exeflags.exec, "--depwarn=yes")
229-
if Base.JLOptions().project != C_NULL
230-
push!(test_exeflags.exec, "--project=$(unsafe_string(Base.JLOptions().project))")
231-
end
229+
push!(test_exeflags.exec, "--project=$(Base.active_project())")
232230
const test_exename = popfirst!(test_exeflags.exec)
233231
function addworker(X; kwargs...)
234232
exename = if do_sanitize

test/setup.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,7 @@ end
232232
function julia_exec(args::Cmd, env...)
233233
# FIXME: this doesn't work when the compute mode is set to exclusive
234234
cmd = Base.julia_cmd()
235-
if Base.JLOptions().project != C_NULL
236-
cmd = `$cmd --project=$(unsafe_string(Base.JLOptions().project))`
237-
end
238-
cmd = `$cmd --color=no $args`
235+
cmd = `$cmd --project=$(Base.active_project()) --color=no $args`
239236

240237
out = Pipe()
241238
err = Pipe()

0 commit comments

Comments
 (0)