Skip to content

Commit 8cbe4c6

Browse files
alerquesimonmichael
authored andcommitted
fix: Escape special symbols when passing arguments to addons
1 parent abc559f commit 8cbe4c6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

hledger/Hledger/Cli.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,9 @@ main = handleExit $ withGhcDebug' $ do
452452
let
453453
addonargs0 = filter (/="--") $ supportedgenargsfromconf <> confcmdargs <> cliargswithoutcmd
454454
addonargs = dropCliSpecificOpts addonargs0
455-
shellcmd = printf "%s-%s %s" progname cmdname (unwords' addonargs) :: String
455+
shellcmd = printf "%s-%s %s" progname cmdname (unwords $ map quoteForCommandLine addonargs) :: String
456456
dbgio "addon command selected" cmdname
457-
dbgio "addon command arguments after removing cli-specific opts" (map quoteIfNeeded addonargs)
457+
dbgio "addon command arguments" addonargs
458458
dbg1IO "running addon" shellcmd
459459
system shellcmd >>= exitWith
460460

hledger/Hledger/Cli/Commands/Run.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ runCommand defaultJournalOverride findBuiltinCommand addons cmdline = do
160160
then run (Just jpaths) findBuiltinCommand addons opts
161161
else cmdaction opts j
162162
Nothing | cmdname `elem` addons ->
163-
system (printf "%s-%s %s" progname cmdname (unwords' args)) >>= exitWith
163+
system (printf "%s-%s %s" progname cmdname (unwords $ map quoteForCommandLine args)) >>= exitWith
164164
Nothing ->
165165
error' $ "Unrecognized command: " ++ unwords (cmdname:args)
166166
[] -> return ()

0 commit comments

Comments
 (0)