fix(ui-query): proper argument quoting in wrapper script

Use printf %q to escape arguments before passing through nix-shell --run.
Fixes handling of arguments containing spaces or special characters.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
dan 2026-01-15 14:23:38 -08:00
parent 1875cbf751
commit f449c60c74

View file

@ -35,6 +35,13 @@ case "$CMD" in
;;
esac
# Quote arguments properly for passing through --run
QUOTED_ARGS=""
for arg in "$@"; do
printf -v ESCAPED '%q' "$arg"
QUOTED_ARGS="$QUOTED_ARGS $ESCAPED"
done
exec nix-shell -p "python3.withPackages (ps: [ ps.pyatspi ps.pygobject3 ])" \
at-spi2-core gobject-introspection \
--run "python3 '$SCRIPT_DIR/$SCRIPT' $*"
--run "python3 '$SCRIPT_DIR/$SCRIPT'$QUOTED_ARGS"