diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-12-15 21:08:22 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-12-15 21:08:22 -0400 |
| commit | 47a2b72bed3770d3dfb26c4142479c436a11ce55 (patch) | |
| tree | 3d67f32c91338193a21aadb26f0d001d5cec9670 /src/Utility/SafeCommand.hs | |
| parent | 571318218c5598ad841cc3dff73c9fee2c7216ef (diff) | |
Merged Utility changes from git-annex.
Diffstat (limited to 'src/Utility/SafeCommand.hs')
| -rw-r--r-- | src/Utility/SafeCommand.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Utility/SafeCommand.hs b/src/Utility/SafeCommand.hs index 9102b726..5ce17a84 100644 --- a/src/Utility/SafeCommand.hs +++ b/src/Utility/SafeCommand.hs @@ -14,6 +14,7 @@ import Utility.Process import Data.String.Utils import System.FilePath import Data.Char +import Data.List import Control.Applicative import Prelude @@ -85,7 +86,7 @@ shellEscape :: String -> String shellEscape f = "'" ++ escaped ++ "'" where -- replace ' with '"'"' - escaped = join "'\"'\"'" $ split "'" f + escaped = intercalate "'\"'\"'" $ split "'" f -- | Unescapes a set of shellEscaped words or filenames. shellUnEscape :: String -> [String] @@ -105,10 +106,10 @@ shellUnEscape s = word : shellUnEscape rest | otherwise = inquote q (w++[c]) cs -- | For quickcheck. -prop_idempotent_shellEscape :: String -> Bool -prop_idempotent_shellEscape s = [s] == (shellUnEscape . shellEscape) s -prop_idempotent_shellEscape_multiword :: [String] -> Bool -prop_idempotent_shellEscape_multiword s = s == (shellUnEscape . unwords . map shellEscape) s +prop_isomorphic_shellEscape :: String -> Bool +prop_isomorphic_shellEscape s = [s] == (shellUnEscape . shellEscape) s +prop_isomorphic_shellEscape_multiword :: [String] -> Bool +prop_isomorphic_shellEscape_multiword s = s == (shellUnEscape . unwords . map shellEscape) s -- | Segments a list of filenames into groups that are all below the maximum -- command-line length limit. |
