From dca119a18692d2ec7e8af5ea414dc3dd32d4d304 Mon Sep 17 00:00:00 2001 From: Benjamin Lupton Date: Thu, 8 Aug 2024 05:05:02 +0800 Subject: [PATCH] environment.*: env crashes detected, close #235 --- sources/environment.elv | 1 + sources/environment.fish | 5 ++++- sources/environment.nu | 1 + sources/environment.sh | 9 +++------ sources/environment.xsh | 1 + 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sources/environment.elv b/sources/environment.elv index 6804d4867..a832e89c7 100644 --- a/sources/environment.elv +++ b/sources/environment.elv @@ -2,3 +2,4 @@ # set the environment variables eval ($E:DOROTHY'/commands/setup-environment-commands' elvish | slurp) +# @todo: someone experienced with elvish should send a PR to add detection (like fish and bash have) on failures of the above command diff --git a/sources/environment.fish b/sources/environment.fish index 9cbbc3b03..ece124a87 100644 --- a/sources/environment.fish +++ b/sources/environment.fish @@ -1,4 +1,7 @@ #!/usr/bin/env fish # set the environment variables -eval ("$DOROTHY/commands/setup-environment-commands" fish) +eval ("$DOROTHY/commands/setup-environment-commands" fish || begin + echo "DOROTHY FAILED TO SETUP ENVIRONMENT, RUN THIS TO DEBUG: bash -x '$DOROTHY/commands/setup-environment-commands' fish" >/dev/stderr + return 1 +end) diff --git a/sources/environment.nu b/sources/environment.nu index da33f28c0..2aeb68e3f 100644 --- a/sources/environment.nu +++ b/sources/environment.nu @@ -7,3 +7,4 @@ setup-environment-commands 'nu' | transpose -r | into record | load-env +# @todo: someone experienced with nu should send a PR to add detection (like fish and bash have) on failures of the above command diff --git a/sources/environment.sh b/sources/environment.sh index dd73eef88..4a865c0ec 100644 --- a/sources/environment.sh +++ b/sources/environment.sh @@ -16,10 +16,7 @@ else fi # set the environment variables -{ - eval "$("$DOROTHY/commands/setup-environment-commands" "$ACTIVE_POSIX_SHELL")" -} || { - echo "Failed to setup environment, failed command was:" - echo "$DOROTHY/commands/setup-environment-commands" "$ACTIVE_POSIX_SHELL" +eval "$("$DOROTHY/commands/setup-environment-commands" "$ACTIVE_POSIX_SHELL" || { + echo "DOROTHY FAILED TO SETUP ENVIRONMENT, RUN THIS TO DEBUG: bash -x '$DOROTHY/commands/setup-environment-commands' '$ACTIVE_POSIX_SHELL'" >/dev/stderr return 1 -} >/dev/stderr +})" diff --git a/sources/environment.xsh b/sources/environment.xsh index 6020bac65..9889e58de 100644 --- a/sources/environment.xsh +++ b/sources/environment.xsh @@ -2,3 +2,4 @@ # set the environment variables evalx(compilex($(@($DOROTHY + '/commands/setup-environment-commands') xonsh))) +# @todo: someone experienced with xonsh should send a PR to add detection (like fish and bash have) on failures of the above command