Skip to content

Instantly share code, notes, and snippets.

@tcely
Created January 8, 2026 13:06
Show Gist options
  • Select an option

  • Save tcely/a16186fdd9e47189e31c8cd9c5fbfea1 to your computer and use it in GitHub Desktop.

Select an option

Save tcely/a16186fdd9e47189e31c8cd9c5fbfea1 to your computer and use it in GitHub Desktop.
Trying different things with `zx` so I put together an easy way to run it.
~/.cache $ DEBUG_ZX_SH=true zx_run 'jsr:@webpod/zx' <<<'console.log( await $({ verbose: true })`echo Hello world! | xargs -t -n 1 echo` )'
+ install -d -m 00775 /data/data/com.termux/files/../cache/zx
+ cd /data/data/com.termux/files/../cache/zx
+ zx=jsr:@webpod/zx
+ shift
+ exec deno run --no-config --allow-read=/data/data/com.termux/files/usr/bin/bash --allow-read=/data/data/com.termux/files/files/home --allow-read=/data/data/com.termux/files/../cache --ignore-read --allow-write=/data/data/com.termux/files/../cache/zx --allow-env --allow-run --allow-sys=homedir,uid,gid,cpus -- jsr:@webpod/zx
~/.cache $ DEBUG_ZX_SH=true zx_run 'npm:zx' <<<'console.log( await $({ verbose: true })`echo Hello world! | xargs -t -n 1 echo` )'
+ install -d -m 00775 /data/data/com.termux/files/../cache/zx
+ cd /data/data/com.termux/files/../cache/zx
+ zx=npm:zx
+ shift
+ exec deno run --no-config --allow-read=/data/data/com.termux/files/usr/bin/bash --allow-read=/data/data/com.termux/files/files/home --allow-read=/data/data/com.termux/files/../cache --ignore-read --allow-write=/data/data/com.termux/files/../cache/zx --allow-env --allow-run --allow-sys=homedir,uid,gid,cpus -- npm:zx
$ echo Hello world! | xargs -t -n 1 echo
echo Hello
Hello
echo 'world!'
world!
ProcessOutput {
  stdout: 'Hello\nworld!\n',
  stderr: "echo Hello\necho 'world!'\n",
  signal: null,
  exitCode: 0,
  duration: 124
}
#!/bin/sh
set -eu
test -n "${DEBUG_ZX_SH-}" && set -x || set +x
install -d -m 00775 "${TERMUX__ROOTFS_DIR}/../cache/zx"
cd "${TERMUX__ROOTFS_DIR}/../cache/zx"
case "$1" in
(npm:zx*) zx="$1" ; shift ;;
(jsr:@webpod/zx*) zx="$1" ; shift ;;
(*) zx='npm:zx' ;;
esac
exec deno ${DEBUG_ZX_DENO:+-L debug} run --no-config \
--allow-read="${TERMUX__ROOTFS_DIR}/usr/bin/bash" \
--allow-read="${TERMUX__ROOTFS_DIR}/files/home" \
--allow-read="${TERMUX__ROOTFS_DIR}/../cache" \
--ignore-read \
--allow-write="${TERMUX__ROOTFS_DIR}/../cache/zx" \
--allow-env \
--allow-run \
--allow-sys='homedir,uid,gid,cpus' \
-- "${zx}" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment