Skip to content

Commit cb2b48e

Browse files
authored
Merge pull request #834 from pxl-th/master
Fix choose_env
2 parents d85bca7 + fab3c0a commit cb2b48e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/runserver.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ function runserver(pipe_in=stdin, pipe_out=stdout, env_path=choose_env(),
4646
run(server)
4747
end
4848

49-
choose_env() = something(get(ARGS, 1, nothing), # 1. path passed explicitly
50-
Base.current_project(pwd()), # 2. parent project of pwd()
51-
Base.load_path_expand("@v#.#")) # 3. default "global" env
49+
function choose_env()
50+
maybe_dirname = x -> x !== nothing ? dirname(x) : nothing
51+
something(get(ARGS, 1, nothing), # 1. path passed explicitly
52+
maybe_dirname(Base.current_project(pwd())), # 2. parent project of pwd()
53+
maybe_dirname(Base.load_path_expand("@v#.#"))) # 3. default "global" env
54+
end

0 commit comments

Comments
 (0)