From afa6afe94e5e34e1d1ceb617b108cf17273cce58 Mon Sep 17 00:00:00 2001 From: Malo Bourgon Date: Fri, 29 Jan 2021 13:42:02 -0800 Subject: [PATCH] Switch from using process to typed-process --- package.yaml | 2 +- prefmanager.cabal | 4 ++-- prefmanager.nix | 4 ++-- src/Defaults.hs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.yaml b/package.yaml index 8917b97..09639c8 100644 --- a/package.yaml +++ b/package.yaml @@ -28,8 +28,8 @@ library: - plist - prettyprinter - prettyprinter-ansi-terminal - - process - text + - typed-process executables: prefmanager: diff --git a/prefmanager.cabal b/prefmanager.cabal index 478cbc1..84af11f 100644 --- a/prefmanager.cabal +++ b/prefmanager.cabal @@ -4,7 +4,7 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: 1a8cff5464ff5ded24a399492c6be76412d42e1e21780bb40565735f140afab2 +-- hash: f6c3525e0baa5d12b8726a3fb2e8555c5e71a4604b8cccf146af041be3186c93 name: prefmanager version: 0.1.0.0 @@ -46,9 +46,9 @@ library , plist , prettyprinter , prettyprinter-ansi-terminal - , process , relude , text + , typed-process default-language: Haskell2010 executable prefmanager diff --git a/prefmanager.nix b/prefmanager.nix index 9d65665..ada4732 100644 --- a/prefmanager.nix +++ b/prefmanager.nix @@ -1,6 +1,6 @@ { mkDerivation, ansi-terminal, async, base-noprelude, containers , hpack, hxt, optparse-applicative, patience, plist, prettyprinter -, prettyprinter-ansi-terminal, process, relude, stdenv, text +, prettyprinter-ansi-terminal, relude, stdenv, text, typed-process }: mkDerivation { pname = "prefmanager"; @@ -10,7 +10,7 @@ mkDerivation { isExecutable = true; libraryHaskellDepends = [ ansi-terminal async base-noprelude containers hxt patience plist - prettyprinter prettyprinter-ansi-terminal process relude text + prettyprinter prettyprinter-ansi-terminal relude text typed-process ]; libraryToolDepends = [ hpack ]; executableHaskellDepends = [ base-noprelude optparse-applicative ]; diff --git a/src/Defaults.hs b/src/Defaults.hs index 40dc308..6877fb7 100644 --- a/src/Defaults.hs +++ b/src/Defaults.hs @@ -16,13 +16,13 @@ import Patience.Map (diff, isSame, toDelta) import Prettyprinter.Render.Terminal (putDoc) import System.Console.ANSI (clearLine, setCursorColumn) import System.IO (hFlush) -import System.Process (shell, readCreateProcess) import Text.XML.HXT.Core (no, withSubstDTDEntities, withValidate) import Text.XML.Plist (PlObject, fromPlDict, readPlistFromString) +import System.Process.Typed (shell, readProcessStdout_) -- | Convenience function for running macOS @defaults@ command. defaultsCmd :: Text -> IO Text -defaultsCmd (toString -> t) = toText <$> readCreateProcess (shell $ "/usr/bin/defaults " <> t) "" +defaultsCmd (toString -> t) = decodeUtf8 <$> readProcessStdout_ (shell $ "/usr/bin/defaults " <> t) -- | Convenience function for parsing Plist strings parsePlist :: Text -> IO PlObject