From 9d10cfa1806c59ad7eb12cd2a313f068ee7b74b3 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 15 Apr 2014 13:07:43 -0700 Subject: [PATCH] fix single-quote-containing addon arguments harder --- hledger-lib/Hledger/Utils.hs | 2 +- hledger/Hledger/Cli/Main.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Hledger/Utils.hs b/hledger-lib/Hledger/Utils.hs index 34d66c43c..dbb30a8cb 100644 --- a/hledger-lib/Hledger/Utils.hs +++ b/hledger-lib/Hledger/Utils.hs @@ -136,7 +136,7 @@ words' s = map stripquotes $ fromparse $ parsewith p s -- | Quote-aware version of unwords - single-quote strings which contain whitespace unwords' :: [String] -> String -unwords' = unwords . map singleQuoteIfNeeded +unwords' = unwords . map quoteIfNeeded -- | Strip one matching pair of single or double quotes on the ends of a string. stripquotes :: String -> String diff --git a/hledger/Hledger/Cli/Main.hs b/hledger/Hledger/Cli/Main.hs index 1b748bdae..dca74b540 100644 --- a/hledger/Hledger/Cli/Main.hs +++ b/hledger/Hledger/Cli/Main.hs @@ -255,7 +255,7 @@ main = do | isExternalCommand = do let shellcmd = printf "%s-%s %s" progname cmd (unwords' argsaftercmd) :: String dbgM "external command selected" cmd - dbgM "external command arguments" argsaftercmd + dbgM "external command arguments" (map quoteIfNeeded argsaftercmd) dbgM "running shell command" shellcmd system shellcmd >>= exitWith