From ba6ad1494729376adb074f54736442f37e4d0476 Mon Sep 17 00:00:00 2001 From: Chris Elrod Date: Tue, 22 Mar 2022 12:52:28 -0400 Subject: [PATCH 1/2] Safer loading --- Project.toml | 2 +- src/CPUSummary.jl | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 0a9491b..0644b59 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "CPUSummary" uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9" authors = ["chriselrod and contributors"] -version = "0.1.16" +version = "0.1.17" [deps] Hwloc = "0e44f5e4-bd66-52a0-8798-143a42290a1d" diff --git a/src/CPUSummary.jl b/src/CPUSummary.jl index a16e561..4e32bd6 100644 --- a/src/CPUSummary.jl +++ b/src/CPUSummary.jl @@ -11,7 +11,11 @@ use_hwloc(b) = @set_preferences!("hwloc" => b) @static if USE_HWLOC try - p = run(`$(Base.julia_cmd()) --project=$(Base.active_project()) -e'using Hwloc; Hwloc.gettopology()'`, wait=false) + script = """ + $(Base.load_path_setup_code()) + using Hwloc; Hwloc.gettopology() + """ + p = run(`$(Base.julia_cmd()) -e $(script)`, wait=false) wait(p) if p.exitcode == 0 && p.termsignal == 0 include("topology.jl") From ed9b3aa7364f27c183ca6d377c45b2b4f42a30e2 Mon Sep 17 00:00:00 2001 From: Chris Elrod Date: Tue, 22 Mar 2022 14:31:29 -0400 Subject: [PATCH 2/2] Use `require` --- src/CPUSummary.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CPUSummary.jl b/src/CPUSummary.jl index 4e32bd6..30253bf 100644 --- a/src/CPUSummary.jl +++ b/src/CPUSummary.jl @@ -13,7 +13,8 @@ use_hwloc(b) = @set_preferences!("hwloc" => b) try script = """ $(Base.load_path_setup_code()) - using Hwloc; Hwloc.gettopology() + Hwloc = Base.require(Base.PkgId(Base.UUID("0e44f5e4-bd66-52a0-8798-143a42290a1d"), "Hwloc")) + Hwloc.gettopology() """ p = run(`$(Base.julia_cmd()) -e $(script)`, wait=false) wait(p)