Skip to content

Commit

Permalink
Merge efa8f00 into 87bb929
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Nov 17, 2023
2 parents 87bb929 + efa8f00 commit b1f67ae
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/ci.shellcode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,22 @@ jobs:
echo 'dev did not fail when already activated' >&2
exit 1
fi
x-already-defined-works:
needs: compile
runs-on: ubuntu-latest
defaults:
run:
shell: zsh -eo pipefail {0}
steps:
- uses: actions/download-artifact@v3
with:
path: /usr/local/bin
name: pkgx
- name: prep
run: chmod u+x /usr/local/bin/pkgx

- run: |
alias x="echo hi"
eval "$(pkgx --shellcode)"
test "$(x)" = hi
38 changes: 20 additions & 18 deletions src/modes/shellcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,26 @@ export default function() {
esac
}
x() {
case $1 in
"")
if [ -f "${tmp}/shellcode/x.$$" ]; then
if foo="$("${tmp}/shellcode/u.$$")"; then
eval "$foo"
${sh} "${tmp}/shellcode/x.$$"
unset foo
fi
rm "${tmp}/shellcode/"?.$$
else
echo "pkgx: nothing to run" >&2
return 1
fi;;
*)
command pkgx -- "$@";;
esac
}
if ! type x >/dev/null 2>&1; then
x() {
case $1 in
"")
if [ -f "${tmp}/shellcode/x.$$" ]; then
if foo="$("${tmp}/shellcode/u.$$")"; then
eval "$foo"
${sh} "${tmp}/shellcode/x.$$"
unset foo
fi
rm "${tmp}/shellcode/"?.$$
else
echo "pkgx: nothing to run" >&2
return 1
fi;;
*)
command pkgx -- "$@";;
esac
}
fi
env() {
for arg in "$@"; do
Expand Down

0 comments on commit b1f67ae

Please sign in to comment.