Bug report
source bin/activate.csh fails in a non-interactive shell, because it saves the prompt unconditionally:
set _OLD_VIRTUAL_PROMPT="$prompt"
prompt is only set in interactive shells, and csh fails on an undefined variable:
prompt: Undefined variable.
The activation is incomplete in both implementations, but the effect differs:
- with csh (OpenBSD) the error is fatal and the script exits with status 1;
- with tcsh (FreeBSD, NetBSD, DragonFly BSD) it only aborts sourcing and the exit status stays 0, so the failure is silent.
PATH and VIRTUAL_ENV are set, because they come earlier in the file, but the pydoc alias and rehash at the end are skipped, and _OLD_VIRTUAL_PROMPT is never saved.
test_venv.test_special_chars_csh fails on OpenBSD for this reason. It passes on tcsh platforms because it only checks what is set before the failing line.
The prompt is not needed in a non-interactive shell, so the block can be guarded with if ($?prompt). The deactivate alias already handles an unset _OLD_VIRTUAL_PROMPT: it is invoked that way at activation, before the variable is set.
Linked PRs
Bug report
source bin/activate.cshfails in a non-interactive shell, because it saves the prompt unconditionally:promptis only set in interactive shells, and csh fails on an undefined variable:The activation is incomplete in both implementations, but the effect differs:
PATHandVIRTUAL_ENVare set, because they come earlier in the file, but thepydocalias andrehashat the end are skipped, and_OLD_VIRTUAL_PROMPTis never saved.test_venv.test_special_chars_cshfails on OpenBSD for this reason. It passes on tcsh platforms because it only checks what is set before the failing line.The prompt is not needed in a non-interactive shell, so the block can be guarded with
if ($?prompt). Thedeactivatealias already handles an unset_OLD_VIRTUAL_PROMPT: it is invoked that way at activation, before the variable is set.Linked PRs