fix: Escape special symbols when passing arguments to addons

This commit is contained in:
Caleb Maclennan 2025-09-30 20:14:52 -06:00 committed by Simon Michael
parent abc559f39a
commit 8cbe4c6003
2 changed files with 3 additions and 3 deletions

View File

@ -452,9 +452,9 @@ main = handleExit $ withGhcDebug' $ do
let
addonargs0 = filter (/="--") $ supportedgenargsfromconf <> confcmdargs <> cliargswithoutcmd
addonargs = dropCliSpecificOpts addonargs0
shellcmd = printf "%s-%s %s" progname cmdname (unwords' addonargs) :: String
shellcmd = printf "%s-%s %s" progname cmdname (unwords $ map quoteForCommandLine addonargs) :: String
dbgio "addon command selected" cmdname
dbgio "addon command arguments after removing cli-specific opts" (map quoteIfNeeded addonargs)
dbgio "addon command arguments" addonargs
dbg1IO "running addon" shellcmd
system shellcmd >>= exitWith

View File

@ -160,7 +160,7 @@ runCommand defaultJournalOverride findBuiltinCommand addons cmdline = do
then run (Just jpaths) findBuiltinCommand addons opts
else cmdaction opts j
Nothing | cmdname `elem` addons ->
system (printf "%s-%s %s" progname cmdname (unwords' args)) >>= exitWith
system (printf "%s-%s %s" progname cmdname (unwords $ map quoteForCommandLine args)) >>= exitWith
Nothing ->
error' $ "Unrecognized command: " ++ unwords (cmdname:args)
[] -> return ()