diff options
author | Profpatsch <mail@profpatsch.de> | 2023-01-02T00·27+0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2023-01-02T00·50+0000 |
commit | 545f9384b568ef41efa28779e4cf0222d2b0ee94 (patch) | |
tree | 2d14856ff9336a62f8fe5f5ffdb9fd28e0cd3cd5 /users/Profpatsch/lorri-wait-for-eval/LorriWaitForEval.hs | |
parent | 7168cb0ed39346049280db8edde34cd79ea0de59 (diff) |
fix(users/Profpatsch/lorri-wait-for-eval): actually search for shell r/5561
The function & error message said it was searching upwards for shell.nix, but it didn’t actually search upwards. Change-Id: I7b81d20a1cc19fdccdc7828427cf17b42e57f414 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7718 Tested-by: BuildkiteCI Autosubmit: Profpatsch <mail@profpatsch.de> Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to '')
-rw-r--r-- | users/Profpatsch/lorri-wait-for-eval/LorriWaitForEval.hs | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/users/Profpatsch/lorri-wait-for-eval/LorriWaitForEval.hs b/users/Profpatsch/lorri-wait-for-eval/LorriWaitForEval.hs index 05c5eb9f2bb6..180def3425a9 100644 --- a/users/Profpatsch/lorri-wait-for-eval/LorriWaitForEval.hs +++ b/users/Profpatsch/lorri-wait-for-eval/LorriWaitForEval.hs @@ -11,33 +11,33 @@ module Main where import Conduit -import qualified Conduit as Cond +import Conduit qualified as Cond import Control.Concurrent -import qualified Control.Concurrent.Async as Async +import Control.Concurrent.Async qualified as Async import Control.Monad -import qualified Data.Aeson.BetterErrors as Json +import Data.Aeson.BetterErrors qualified as Json import Data.Bifunctor import Data.ByteString (ByteString) -import qualified Data.Conduit.Binary as Conduit.Binary -import qualified Data.Conduit.Combinators as Cond +import Data.Conduit.Binary qualified as Conduit.Binary +import Data.Conduit.Combinators qualified as Cond import Data.Conduit.Process import Data.Error import Data.Function import Data.Functor import Data.List.NonEmpty (NonEmpty ((:|)), nonEmpty) import Data.Text (Text) -import qualified Data.Text as Text -import qualified Data.Text.Encoding -import qualified Data.Text.Encoding.Error +import Data.Text qualified as Text +import Data.Text.Encoding qualified +import Data.Text.Encoding.Error qualified import Data.Text.IO (hPutStrLn) import PyF -import qualified System.Directory as Dir -import qualified System.Environment as Env -import qualified System.Exit as Exit +import System.Directory qualified as Dir +import System.Environment qualified as Env +import System.Exit qualified as Exit import System.FilePath (takeDirectory) -import qualified System.FilePath.Posix as FilePath +import System.FilePath.Posix qualified as FilePath import System.IO (stderr) -import qualified System.Posix as Posix +import System.Posix qualified as Posix import Prelude hiding (log) data LorriEvent = LorriEvent @@ -46,11 +46,6 @@ data LorriEvent = LorriEvent } deriving stock (Show) -data ChanToken a - = -- | so we can see that the lorri thread has been initialized - NoEventYet - | ChanEvent a - data LorriEventType = Completed | Started @@ -168,8 +163,12 @@ findShellNix curDir = do let file = dir FilePath.</> "shell.nix" Dir.doesFileExist file >>= \case True -> pure (Just file) - False -> pure Nothing - go curDir + False -> do + let parent = FilePath.takeDirectory dir + if parent == dir + then pure Nothing + else go parent + go (FilePath.normalise curDir) textToString :: Text -> String textToString = Text.unpack |