Skip to content

Commit 65de2c4

Browse files
authored
Don't touch the file system when precompiling (#220)
1 parent c64924f commit 65de2c4

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/ReTestItems.jl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,19 @@ include("log_capture.jl")
9090
include("filtering.jl")
9191

9292
function __init__()
93-
DEFAULT_STDOUT[] = stdout
94-
DEFAULT_STDERR[] = stderr
95-
DEFAULT_LOGSTATE[] = Base.CoreLogging._global_logstate
96-
DEFAULT_LOGGER[] = Base.CoreLogging._global_logstate.logger
97-
# Disable killing workers based on memory pressure on MacOS til calculations fixed.
98-
# TODO: fix https://github.com/JuliaTesting/ReTestItems.jl/issues/113
99-
@static if Sys.isapple()
100-
DEFAULT_MEMORY_THRESHOLD[] = 1.0
93+
if ccall(:jl_generating_output, Cint, ()) == 0 # not precompiling
94+
DEFAULT_STDOUT[] = stdout
95+
DEFAULT_STDERR[] = stderr
96+
DEFAULT_LOGSTATE[] = Base.CoreLogging._global_logstate
97+
DEFAULT_LOGGER[] = Base.CoreLogging._global_logstate.logger
98+
# Disable killing workers based on memory pressure on MacOS til calculations fixed.
99+
# TODO: fix https://github.com/JuliaTesting/ReTestItems.jl/issues/113
100+
@static if Sys.isapple()
101+
DEFAULT_MEMORY_THRESHOLD[] = 1.0
102+
end
103+
# Defer setting up the temp folder for pkgimage relocability
104+
RETESTITEMS_TEMP_FOLDER[] = mkpath(joinpath(tempdir(), "ReTestItemsTempLogsDirectory"))
101105
end
102-
# Defer setting up the temp folder for pkgimage relocability
103-
RETESTITEMS_TEMP_FOLDER[] = mkpath(joinpath(tempdir(), "ReTestItemsTempLogsDirectory"))
104106
return nothing
105107
end
106108

0 commit comments

Comments
 (0)