diff options
author | Fabian Kirchner <kirchner@posteo.de> | 2023-10-13 22:20:18 +0200 |
---|---|---|
committer | Fabian Kirchner <kirchner@posteo.de> | 2023-10-13 22:20:18 +0200 |
commit | 51663eab50cbc51a5786c0d55f21de62e9b15c0a (patch) | |
tree | cca6f3b4cfe39f89d62370fe425dea43b1107622 /app/Process.hs | |
parent | a0c72a80fbfed8e0963edff17ab5d52d2e3abd5b (diff) |
extract quote to Process and fix quoting quotes
Diffstat (limited to 'app/Process.hs')
-rw-r--r-- | app/Process.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/Process.hs b/app/Process.hs index 39132d4..ecc9cd3 100644 --- a/app/Process.hs +++ b/app/Process.hs @@ -23,3 +23,10 @@ sh_ proc = do if exitCode == ExitSuccess then pure () else throwIO $ ProcessException (show proc) exitCode err + +quote :: String -> String +quote s = "'" ++ escape s ++ "'" + where + escape [] = [] + escape ('\'' : cs) = '\'' : '\\' : '\'' : '\'' : escape cs + escape (c : cs) = c : escape cs |