From c744144b3617bcf5654b973a4fe0370f8438ea0a Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Tue, 7 Jul 2015 23:23:32 +0200 Subject: [PATCH] Escape string for the shell --- skeleton.cabal | 2 +- src/Main.hs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/skeleton.cabal b/skeleton.cabal index df83c3c..b11e42c 100644 --- a/skeleton.cabal +++ b/skeleton.cabal @@ -28,5 +28,5 @@ executable skeleton TypeSynonymInstances build-depends: base >=4.8 && <= 5.0, filepath, process, attoparsec, bytestring, hex, time, - argparser + argparser, posix-escape ghc-options: -O2 diff --git a/src/Main.hs b/src/Main.hs index 7f4154a..5dd3b38 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -4,10 +4,11 @@ import Skeleton.Types import Skeleton.Pretty import Skeleton.Parser -import Control.Monad (when) -import Data.List (isInfixOf) -import System.FilePath (takeBaseName) -import System.Process (readProcess, callCommand) +import Control.Monad (when) +import Data.List (isInfixOf) +import System.FilePath (takeBaseName) +import System.Process (readProcess, callCommand) +import System.Posix.Escape (escape) import System.Console.ArgParser @@ -42,7 +43,7 @@ getKeychain paths = do sendClipboard :: String -> IO () sendClipboard text = - callCommand $ "echo " ++ (show text) ++ " | pbcopy" + callCommand $ "echo " ++ (escape text) ++ " | pbcopy" -- CLI arguments --