hedgehog-extras-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Hedgehog.Extras.Test.Process

Synopsis

Documentation

createProcess :: (MonadTest m, MonadResource m, HasCallStack) => CreateProcess -> m (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle, ReleaseKey) Source #

Create a process returning handles to stdin, stdout, and stderr as well as the process handle.

execFlex :: (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) => String -> String -> [String] -> m String Source #

Create a process returning its stdout.

Being a flex function means that the environment determines how the process is launched.

When running in a nix environment, the envBin argument describes the environment variable that defines the binary to use to launch the process.

When running outside a nix environment, the pkgBin describes the name of the binary to launch via cabal exec.

procFlex Source #

Arguments

:: (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) 
=> String

Cabal package name corresponding to the executable

-> String

Environment variable pointing to the binary to run

-> [String]

Arguments to the CLI command

-> m CreateProcess

Captured stdout

Create a CreateProcess describing how to start a process given the Cabal package name corresponding to the executable, an environment variable pointing to the executable, and an argument list.

The actual executable used will the one specified by the environment variable, but if the environment variable is not defined, it will be found instead by consulting the "plan.json" generated by cabal. It is assumed that the project has already been configured and the executable has been built.

getProjectBase :: (MonadTest m, MonadIO m) => m String Source #

Compute the project base. This will be based on either the CARDANO_NODE_SRC environment variable or the parent directory. Both should point to the root directory of the Github project checkout.

waitForProcess :: (MonadTest m, MonadIO m, HasCallStack) => ProcessHandle -> m ExitCode Source #

Wait for process to exit.

maybeWaitForProcess :: (MonadTest m, MonadIO m, HasCallStack) => ProcessHandle -> m (Maybe ExitCode) Source #

Wait for process to exit or return Nothing if interrupted by an asynchronous exception.

getPid :: (MonadTest m, MonadIO m, HasCallStack) => ProcessHandle -> m (Maybe Pid) Source #

Get the process ID.

waitSecondsForProcess :: (MonadTest m, MonadIO m, HasCallStack) => Int -> ProcessHandle -> m (Either TimedOut ExitCode) Source #

Wait a maximum of seconds secons for process to exit.