Skip to content

Commit

Permalink
properly quote cli args in several locations
Browse files Browse the repository at this point in the history
  • Loading branch information
tek committed Sep 6, 2023
1 parent 856ce95 commit 2aa03ef
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/command.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ let
if command.component
then ''
${splitArgs}
env_runner=$(${cli} env --config ${json} ''${env_args[@]})
env_args="''${env_args[*]}" $env_runner "${exe} ''${cmd_args[@]}"
env_runner=$(${cli} env --config ${json} "''${env_args[@]}")
env_args="''${env_args[*]}" $env_runner "${exe} "''${cmd_args[@]}""
''
else ''
${env.code}
${exe} $@
${exe} "$@"
'';

in {
Expand Down
2 changes: 1 addition & 1 deletion lib/with-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ let
cacheWrapper = self: name: app: pkgs.writeScript name ''
${config.pkgs.nix}/bin/nix --option extra-substituters 'https://tek.cachix.org' \
--option extra-trusted-public-keys 'tek.cachix.org-1:+sdc73WFq8aEKnrVv5j/kuhmnW2hQJuqdPJF5SnaCBk=' \
run ${self}#${app} -- $@
run ${self}#${app} -- "$@"
'';

envSystemAllowed = env:
Expand Down
4 changes: 2 additions & 2 deletions modules/command.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ let
in "${opt "-r" "runner"}${opt "-p" "package"}${opt "-m" "module"}${opt "-c" "component"}";

ghciCommand = ''
ghci_cmd=$(${cli} ghci-cmd --config ${json} ${ghciOpts} ''${env_args[@]} ''$@)
ghci_cmd=$(${cli} ghci-cmd --config ${json} ${ghciOpts} ''${env_args[@]} "''$@")
eval $ghci_cmd
'';

ghcidCommand = ''
ghcid_cmd=$(${cli} ghcid-cmd --config ${json} ${ghciOpts} ''${env_args[@]} ''$@)
ghcid_cmd=$(${cli} ghcid-cmd --config ${json} ${ghciOpts} ''${env_args[@]} "''$@")
eval $ghcid_cmd
'';

Expand Down
2 changes: 1 addition & 1 deletion modules/commands.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ in {
env = "dev";
command = ''
${if config.hls.genCabal then "nix run .#gen-cabal-quiet" else ""}
${config.envs.hls.hls.package}/bin/haskell-language-server $@
${config.envs.hls.hls.package}/bin/haskell-language-server "$@"
'';
expose = true;
};
Expand Down
2 changes: 1 addition & 1 deletion test/new-static/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
test = builtins.toFile "new-static-test" ''
mkdir root
cd ./root
nix run "path:$hix_dir#new" -- --name 'red-panda'
nix run "path:$hix_dir#new" -- --name 'red-panda' --author='Red Panda'
nix run .#gen-cabal
check_match 'nix run .#ghci -- -p red-panda -t main <<< :quit' 'passed 1 test' 'Running tests in generated project failed'
check_match 'nix run' 'Hello red-panda' 'App in generated project failed'
Expand Down

0 comments on commit 2aa03ef

Please sign in to comment.