diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 05e7678..4620499 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -28,9 +28,9 @@ jobs: strategy: matrix: include: - - compiler: ghc-9.4.8 + - compiler: ghc-9.8.4 compilerKind: ghc - compilerVersion: 9.4.8 + compilerVersion: 9.8.4 setup-method: ghcup allow-failure: false fail-fast: false @@ -150,7 +150,6 @@ jobs: echo "package lineman" >> cabal.project echo " ghc-options: -Werror=missing-methods" >> cabal.project cat >> cabal.project <> cabal.project.local cat cabal.project diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b0a5d2..51b76db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ `lineman` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +## 1.0.4 + +* Land on `typed-base` + ## 1.0.3 * Add justfile diff --git a/cabal.project b/cabal.project index 23cbc81..5356e76 100644 --- a/cabal.project +++ b/cabal.project @@ -1,4 +1 @@ -packages: . - -constraints: - http-client-tls == 0.3.6.3 \ No newline at end of file +packages: . \ No newline at end of file diff --git a/hie.yaml b/hie.yaml index 7ff361a..a1d8315 100644 --- a/hie.yaml +++ b/hie.yaml @@ -1,10 +1,10 @@ cradle: cabal: - - path: "./src" + - path: "src" component: "lib:lineman" - - path: "./app/Main.hs" + - path: "app/Main.hs" component: "lineman:exe:lineman" - - path: "./test" + - path: "test" component: "lineman:test:lineman-test" diff --git a/justfile b/justfile index 91135ae..c82b57e 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,4 @@ -GHC_VERSION := "9.4.8" +GHC_VERSION := "9.8.4" # prepare the environment for the project prepare: diff --git a/lineman.cabal b/lineman.cabal index 0a7cb27..d951b4d 100644 --- a/lineman.cabal +++ b/lineman.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: lineman -version: 1.0.3 +version: 1.0.4 synopsis: traverse directory and run command description: Lineman traverses directory recursively and run command by condition @@ -19,14 +19,14 @@ extra-doc-files: CHANGELOG.md README.md -tested-with: GHC ==9.4.8 +tested-with: GHC ==9.8.4 source-repository head type: git location: https://github.com/metaxis/lineman.git common common-options - build-depends: base ^>=4.17.2.1 + build-depends: base ^>=4.19.2.0 ghc-options: -Wall -Wcompat -Widentities -Wincomplete-uni-patterns -Wincomplete-record-updates -Wredundant-constraints @@ -73,11 +73,12 @@ library , path , path-io , pretty-simple - , process + , typed-process , safe-exceptions , stm , text , transformers-base + , witch executable lineman import: common-options diff --git a/src/Lineman.hs b/src/Lineman.hs index 7be1893..dd7b917 100644 --- a/src/Lineman.hs +++ b/src/Lineman.hs @@ -15,13 +15,13 @@ import Control.Monad.IO.Class (liftIO) import Control.Monad.Reader (asks) import Cook (prepareConditions) import qualified Data.Text as T -import GHC.IO.Exception (ExitCode (..)) import Log (logDebug, logError, logInfo) import Path.IO (doesDirExist, doesFileExist, listDir, listDirRecur) import Path.Posix (Abs, Dir, File, Path, PathException, Rel, fileExtension, toFilePath, ()) -import System.Process (CreateProcess (..), proc, readCreateProcessWithExitCode) import System.Process.Extra (showCommandForUser) +import System.Process.Typed import Types (App, Env (..)) +import Witch import Prelude hiding (log) launchAction :: App () @@ -57,15 +57,23 @@ getDirsForCommand target files dirs exts = do action :: FilePath -> [String] -> Path Abs Dir -> App ExitCode action commandName args path = do -- liftIO $ threadDelay 500_000 -- 0.5 seconds + let dateConfig :: ProcessConfig () () () + dateConfig = setWorkingDir (toFilePath path) $ proc commandName args (exitCode, stdout, stderr) <- liftIO $ - readCreateProcessWithExitCode (proc commandName args){cwd = Just $ toFilePath path} "" + readProcess dateConfig case stderr of "" -> pure () - err -> logError $ "In " <> T.pack (show path) <> " occurred stderr: \n" <> T.strip (T.pack err) + err -> logError $ "In " + <> T.pack (show path) + <> " occurred stderr: \n" + <> T.strip (unsafeInto @T.Text $ into @Utf8L err) case stdout of "" -> pure () - out -> logDebug $ "In " <> T.pack (show path) <> " occurred stdout: \n" <> T.pack out + out -> logDebug $ "In " + <> T.pack (show path) + <> " occurred stdout: \n" + <> unsafeInto @T.Text (into @Utf8L out) logDebug $ T.pack (show exitCode) pure exitCode