Output written by activation.scripts is not shown when running in pixi run ... or pixi shell.
Minimal example
pixi.toml:
[workspace]
channels = ["conda-forge"]
platforms = ["linux-64"]
requires-pixi = ">=0.71.3"
[activation]
scripts = ["activation.sh"]
[tasks.bonjour]
cmd = "echo Bonjour"
activation.sh:
#!/usr/bin/env bash
echo "-----> ACTIVATION <-----"
# exit 1
pixi run ... only shows the output of the task. The activation script output is not shown:
$ pixi run bonjour
✨ Pixi task (bonjour): echo Bonjour
Bonjour
The shell starts, but the activation script output is not shown:
Note: if the activation.sh script fails (exit 1), then -----> ACTIVATION <----- can be seen in the output:
✨ Pixi task (bonjour): echo Bonjour
Error: × failed to activate environment
╰─▶ Failed to run activation script for Default. Status: exit status: 1. Stdout: SHELL=/bin/bash
ENV_VAR1=...
ENV_VAR2=...
ENV_VAR3=...
____RATTLER_ENV_START____
-----> ACTIVATION <-----
. Stderr: . Script: /usr/bin/env
echo ____RATTLER_ENV_START____
export PATH="..."
export CONDA_*=...
export PIXI_*=...
. /path/activation.sh
echo ____RATTLER_ENV_START____
/usr/bin/env
Question
Is this the expected behavior?
My use case for this is to have a very lightweight activation script that can print a warning if something is not configured correctly.
Something like:
[activation]
# activation.sh checks that the 'version' and .pixi/setup-version are the same,
# and if not, print a warning suggesting to run 'pixi run setup'
scripts = ["activation.sh"]
[tasks.setup]
depends-on = [
# a sequence of setup tasks...
# "setup-something",
# "setup-whatever",
# 'version' below has to be incremented everytime the 'setup' task is modified
# (i.e. a task is added, or an existing sub-task is modified)
{ task = "_setup-mark-done", args = [
{ version = "1" },
] },
]
description = "Set of idempotent tasks to setup correctly a workstation."
[tasks._setup-mark-done]
args = ["version"]
cmd = "echo {{ version }} > .pixi/setup-version"
Output written by
activation.scriptsis not shown when running inpixi run ...orpixi shell.Minimal example
pixi.toml:activation.sh:pixi run ...only shows the output of the task. The activation script output is not shown:The shell starts, but the activation script output is not shown:
Note: if the
activation.shscript fails (exit 1), then-----> ACTIVATION <-----can be seen in the output:Question
Is this the expected behavior?
My use case for this is to have a very lightweight activation script that can print a warning if something is not configured correctly.
Something like: