Skip to content

Commit cb51e8f

Browse files
committed
ci: fix the underlying failure with xonsh var failures
it cannot delete unset variables, so check them first: - https://github.com/bevry/dorothy/actions/runs/13228345318/job/36922092005#step:9:82
1 parent d3cacc2 commit cb51e8f

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

.github/workflows/dorothy-workflow.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,7 @@ jobs:
109109
command-exists -- dorothy
110110
echo-style --success='ok'
111111
- name: 'Dorothy Login Shell: xonsh'
112-
env:
113-
PKG_CONFIG_PATH: '' # fix: https://github.com/bevry/dorothy/actions/runs/6349881708/job/17248752072#step:8:8
114-
LDFLAGS: '' # fix: https://github.com/bevry/dorothy/actions/runs/6349927188/job/17248892389#step:8:9
115-
CPPFLAGS: '' # fix: https://github.com/bevry/dorothy/actions/runs/6349956372/job/17248986621#step:8:10
116-
CXX: '' # fix: https://github.com/bevry/dorothy/actions/runs/7538723888/job/20519802798#step:8:12
117-
CC: '' #fix: https://github.com/bevry/dorothy/actions/runs/7538922544/job/20520381661#step:8:13
118-
shell: xonsh -DXONSH_SHOW_TRACEBACK=True -l {0}
112+
shell: xonsh -DXONSH_SHOW_TRACEBACK=True -DXONSH_TRACEBACK_LOGFILE=xonsh.log -l {0}
119113
run: |
120114
command-exists -- dorothy
121115
echo-style --success='ok'

sources/env.bash

+23-15
Original file line numberDiff line numberDiff line change
@@ -112,46 +112,54 @@ function on_env_finish {
112112
if [[ -z $value ]]; then
113113
# echo var action: delete
114114
if [[ $shell == 'fish' ]]; then
115-
echo "set --universal --erase $name;"
115+
printf '%s\n' "set --universal --erase $name;"
116116
elif [[ $shell == 'nu' ]]; then
117-
echo "setenv $name"
117+
printf '%s\n' "setenv $name"
118118
elif [[ $shell == 'xonsh' ]]; then
119-
echo 'del $'"$name"
119+
printf '%s\n' "if \${...}.get('$name') != None:"$'\n\t'"del \$$name"
120120
elif [[ $shell == 'elvish' ]]; then
121121
# https://elv.sh/ref/builtin.html#unset-env
122-
echo "unset-env $name"
122+
printf '%s\n' "unset-env $name"
123123
else
124-
echo "unset -v $name;"
124+
printf '%s\n' "unset -v $name;"
125125
fi
126126
elif [[ $is_path == 'yes' ]]; then
127127
# echo var action: set path
128128
if [[ $shell == 'fish' ]]; then
129-
echo "set --export --path $name '$value';"
129+
printf '%s\n' "set --export --path $name '$value';"
130130
elif [[ $shell == 'nu' ]]; then
131-
echo "setenv $name $value"
131+
printf '%s\n' "setenv $name $value"
132132
elif [[ $shell == 'xonsh' ]]; then
133-
echo '$'"$name = '$value'.split(':')"
133+
printf '%s\n' '$'"$name = '$value'.split(':')"
134134
elif [[ $shell == 'elvish' ]]; then
135135
# https://elv.sh/ref/builtin.html#set-env
136-
echo "set-env $name '$value'"
136+
printf '%s\n' "set-env $name '$value'"
137137
else
138-
echo "export $name='$value';"
138+
printf '%s\n' "export $name='$value';"
139139
fi
140140
else
141141
# echo var action: set
142142
if [[ $shell == 'fish' ]]; then
143-
echo "set --export $name '$value';"
143+
printf '%s\n' "set --export $name '$value';"
144144
elif [[ $shell == 'nu' ]]; then
145-
echo "setenv $name $value"
145+
printf '%s\n' "setenv $name $value"
146146
elif [[ $shell == 'xonsh' ]]; then
147-
echo '$'"$name = '$value'"
147+
printf '%s\n' '$'"$name = '$value'"
148148
elif [[ $shell == 'elvish' ]]; then
149149
# https://elv.sh/ref/builtin.html#set-env
150-
echo "set-env $name '$value'"
150+
printf '%s\n' "set-env $name '$value'"
151151
else
152-
echo "export $name='$value';"
152+
printf '%s\n' "export $name='$value';"
153153
fi
154154
fi
155155
done < <(env)
156+
# xonsh needs a trailing newline, because xonsh, fixes:
157+
# > xonsh
158+
# xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
159+
# SyntaxError: None: no further code
160+
# syntax error in xonsh run control file '/Users/balupton/.config/xonsh/rc.xsh': None: no further code
161+
if [[ $shell == 'xonsh' ]]; then
162+
printf '\n'
163+
fi
156164
}
157165
trap on_env_finish EXIT

0 commit comments

Comments
 (0)