File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -17,21 +17,29 @@ function find_jupyter_subcommand(subcommand::AbstractString)
1717 jupyter = joinpath (Conda. SCRIPTDIR, exe (" jupyter" ))
1818 end
1919 end
20+ isconda = dirname (jupyter) == abspath (Conda. SCRIPTDIR)
2021 if ! Sys. isexecutable (jupyter)
21- if dirname (jupyter) == abspath (Conda. SCRIPTDIR) &&
22- isyes (Base. prompt (" install Jupyter via Conda, y/n? [y]" ))
22+ if isconda && isyes (Base. prompt (" install Jupyter via Conda, y/n? [y]" ))
2323 Conda. add (subcommand == " lab" ? " jupyterlab" : " jupyter" )
2424 else
2525 error (" $jupyter is not installed, cannot run $subcommand " )
2626 end
2727 end
2828
29+ cmd = ` $jupyter $subcommand `
30+
2931 # fails in Windows if jupyter directory is not in PATH (jupyter/jupyter_core#62)
30- env = Sys. iswindows () ? Dict (uppercase (k)=> v for (k,v) in ENV ) : copy (ENV ) # julia#29334
3132 pathsep = Sys. iswindows () ? ' ;' : ' :'
32- env[" PATH" ] = haskey (env, " PATH" ) ? dirname (jupyter) * pathsep * env[" PATH" ] : dirname (jupyter)
33+ withenv (" PATH" => dirname (jupyter) * pathsep * get (ENV , " PATH" , " " )) do
34+ if isconda
35+ # sets PATH and other environment variables for Julia's Conda environment
36+ cmd = Conda. _set_conda_env (cmd)
37+ else
38+ setenv (cmd, ENV )
39+ end
40+ end
3341
34- return setenv ( ` $jupyter $subcommand ` , env)
42+ return cmd
3543end
3644
3745# #################################################################
You can’t perform that action at this time.
0 commit comments