Skip to content
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

be more correct when it comes to env handling #338

Merged
merged 1 commit into from
Feb 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions src/PackageCompiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ function move_default_sysimage_if_windows()
end
end

function windows_compiler_artifact_path(f, compiler)
function run_with_env(cmd, compiler)
if Sys.iswindows()
withenv("PATH" => string(ENV["PATH"], ";", dirname(compiler))) do
f()
end
env = copy(ENV)
env["PATH"] = string(env["PATH"], ";", dirname(compiler))
run(Cmd(cmd; env=env))
else
f()
run(cmd)
end
end

Expand Down Expand Up @@ -441,9 +441,7 @@ function create_sysimg_from_object_file(input_object::String, sysimage_path::Str
m = something(march(), ``)
cmd = `$compiler $(bitflag()) $m -shared -L$(julia_libdir) -o $sysimage_path $o_file -ljulia $extra`
@debug "running $cmd"
windows_compiler_artifact_path(compiler) do
run(cmd)
end
run_with_env(cmd, compiler)
return nothing
end

Expand Down Expand Up @@ -646,10 +644,7 @@ function create_executable_from_sysimg(;sysimage_path::String,
m = something(march(), ``)
cmd = `$compiler -DJULIAC_PROGRAM_LIBNAME=$(repr(sysimage_path)) $(bitflag()) $m -o $(executable_path) $(wrapper) $(sysimage_path) -O2 $rpath $flags`
@debug "running $cmd"
run(cmd)
windows_compiler_artifact_path(compiler) do
run(cmd)
end
run_with_env(cmd, compiler)
return nothing
end

Expand Down