diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-09-15 21:10:39 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-09-19 19:44:28 +0200 |
commit | 89ed9a3a6c0ada2b1c252a5e24283b84eb0fa4c8 (patch) | |
tree | 5ba8a271690d43bab73fd4c86ff2702ca8afce45 /src/Run.hs | |
parent | 77fdc01b6dfa6f497ed80a46c51e227ca9bdaeed (diff) |
Add timeout argument for the ‘expect’ command
Changelog: Added `timeout` argument for the `expect` command
Diffstat (limited to 'src/Run.hs')
-rw-r--r-- | src/Run.hs | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -202,8 +202,8 @@ runStep = \case outProc OutputChildStdin p line send p line - Expect line p expr captures inner -> do - expect line p expr captures $ runStep . inner + Expect line p expr timeout captures inner -> do + expect line p expr timeout captures $ runStep . inner Flush p regex -> do atomicallyTest $ flushProcessOutput p regex @@ -318,9 +318,9 @@ exprFailed desc stack pname = do outLine (OutputMatchFail stack) (Just prompt) $ desc <> " failed" throwError Failed -expect :: SourceLine -> Process -> Traced Regex -> [TypedVarName Text] -> ([ Text ] -> TestRun ()) -> TestRun () -expect sline p (Traced trace re) tvars inner = do - timeout <- getCurrentTimeout +expect :: SourceLine -> Process -> Traced Regex -> Scientific -> [TypedVarName Text] -> ([ Text ] -> TestRun ()) -> TestRun () +expect sline p (Traced trace re) etimeout tvars inner = do + timeout <- (etimeout *) <$> getCurrentTimeout delay <- liftIO $ registerDelay $ ceiling $ 1000000 * timeout mbmatch <- atomicallyTest $ (Nothing <$ (check =<< readTVar delay)) <|> do line <- readTVar (procOutput p) |