Pkg.jl
Pkg.jl copied to clipboard
Artifact selection hooks should not read the output TOML dictionary from `stdout`
Currently, artifact selection hooks expect that the hook will print the resultant TOML dictionary to stdout
.
Unfortunately, this means that if you have any other output being printed to stdout
, the artifact selection hooks break. Some examples of this include:
- You have a custom sysimage, and in that custom sysimage there are some
__init__()
functions that print various output tostdout
. - You've enabled a debug mode in your packages, and this debug mode prints various debugging statements to
stdout
.
Instead of having artifact selection hook output printed to stdout
, I would recommend an interface of the following:
- Before we run the artifact selection hook, we
touch
a temporary file, e.g./tmp/mytempdir/myfile.toml
, and we setENV["JULIA_PKG_ARTIFACT_SELECTION_HOOK_OUTPUT"] = "/tmp/mytempdir/myfile.toml"
. - When the hook runs, it writes its TOML dictionary out to the
ENV["JULIA_PKG_ARTIFACT_SELECTION_HOOK_OUTPUT"]
file. - After the hook has run, Pkg reads the TOML dictionary in from the
ENV["JULIA_PKG_ARTIFACT_SELECTION_HOOK_OUTPUT"]
file.
The design mirrors the GITHUB_ENV
file that GitHub Actions uses for passing output between steps.
Sounds like a good idea to me
Can this be done without breaking all existing releases? I don't think so?
Edit: I suppose packages must print to both for a while and in Pkg we use the file output if it is non-empty, otherwise stdout? Then over time the new system will take over.
You've enabled a debug mode in your packages, and this debug mode prints various debugging statements to stdout.
Most of these stuff should probably print to stderr though.