Skip to content

Check that JULIA_PKG_SERVER is non-empty #23

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

Merged
merged 2 commits into from
Mar 9, 2023

Conversation

mortenpi
Copy link
Member

@mortenpi mortenpi commented Mar 9, 2023

Currently, if JULIA_PKG_SERVER is set but empty, you get this:

JULIA_PKG_SERVER= julia -e 'using PkgAuthentication; PkgAuthentication.authenticate()'
ERROR: MethodError: no method matching rstrip(::Nothing, ::Char)
Closest candidates are:
  rstrip(::Any, ::AbstractString) at strings/util.jl:382
  rstrip(::AbstractString, ::Union{AbstractChar, Tuple{Vararg{AbstractChar}}, Set{<:AbstractChar}, AbstractVector{<:AbstractChar}}) at strings/util.jl:389
Stacktrace:
 [1] authenticate(; auth_suffix::Nothing, force::Nothing, tries::Nothing)
   @ PkgAuthentication ~/.julia/packages/PkgAuthentication/YFLW0/src/PkgAuthentication.jl:103
 [2] authenticate()
   @ PkgAuthentication ~/.julia/packages/PkgAuthentication/YFLW0/src/PkgAuthentication.jl:77
 [3] top-level scope
   @ none:1

This is because Pkg.pkg_server() === nothing if JULIA_PKG_SERVER is set, but empty.

With this you get

$ JULIA_PKG_SERVER= julia --project -e 'using PkgAuthentication; PkgAuthentication.authenticate()'
ERROR: The `JULIA_PKG_SERVER` environment variable must be set and non-empty
Stacktrace:
 [1] _assert_pkg_server_env_var_is_set()
   @ PkgAuthentication ~/jc/PkgAuthentication.jl/src/PkgAuthentication.jl:28
 [2] authenticate(; auth_suffix::Nothing, force::Nothing, tries::Nothing)
   @ PkgAuthentication ~/jc/PkgAuthentication.jl/src/PkgAuthentication.jl:100
 [3] authenticate()
   @ PkgAuthentication ~/jc/PkgAuthentication.jl/src/PkgAuthentication.jl:77
 [4] top-level scope
   @ none:1

which is a bit more informative.

@codecov-commenter
Copy link

codecov-commenter commented Mar 9, 2023

Codecov Report

Merging #23 (141053e) into master (87517b4) will decrease coverage by 2.97%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master      #23      +/-   ##
==========================================
- Coverage   73.58%   70.61%   -2.97%     
==========================================
  Files           1        1              
  Lines         212      211       -1     
==========================================
- Hits          156      149       -7     
- Misses         56       62       +6     
Impacted Files Coverage Δ
src/PkgAuthentication.jl 70.61% <50.00%> (-2.97%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pfitzseb pfitzseb merged commit 893678c into JuliaComputing:master Mar 9, 2023
@mortenpi mortenpi deleted the patch-1 branch March 9, 2023 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants