Skip to content

Commit

Permalink
fix parsing of env
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Jun 27, 2023
1 parent 9ee610b commit 7d336e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,11 @@ void jl_init_threading(void)
jl_n_sweepthreads = jl_options.nsweepthreads;
if (jl_n_markthreads == -1) { // --gcthreads not specified
if ((cp = getenv(NUM_GC_THREADS_NAME))) { // ENV[NUM_GC_THREADS_NAME] specified
jl_n_markthreads = (uint64_t)strtol(cp, NULL, 10) - 1;
errno = 0;
jl_n_markthreads = (uint64_t)strtol(cp, &endptr, 10) - 1;
if (errno != 0 || endptr == cp || nthreads <= 0)
jl_n_markthreads = 0;
cp = endptr;
if (*cp == ',') {
cp++;
errno = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
end

withenv("JULIA_NUM_GC_THREADS" => "2,1") do
@test_broken read(`$exename -e $code`, String) == "3"
@test read(`$exename -e $code`, String) == "3"
end

# --machine-file
Expand Down

0 comments on commit 7d336e5

Please sign in to comment.