Module

Ctl.Internal.Spawn

This module provides ability to spawn a program using spawn and wait for some specific output that indicates that the program has started successfully or failed, in which case an exception is thrown.

#NewOutputAction

data NewOutputAction

Provides a way to react on update of a program output. Do nothing, indicate startup success, or thrown an exception to the Aff action, killing the spawned program.

Constructors

#OnSignalRef

#ManagedProcess

data ManagedProcess

Carry along an AVar which resolves when the process closes. Necessary due to child_process having no way to query if a process has closed, so we must listen immediately after spawning.

Constructors

#spawn

spawn :: String -> Array String -> SpawnOptions -> Maybe ({ line :: String, output :: String } -> Effect NewOutputAction) -> Aff ManagedProcess

spawn, but with ability to wait for program startup, using a callback returning a NewOutputAction, or to kill the program depending on its output.

#exec

exec :: String -> Aff { channels :: { stderr :: Readable (), stdout :: Readable () }, process :: ChildProcess }

#stopProcessWithChildren

#waitForStop

waitForStop :: ManagedProcess -> Aff Unit

Waits until the process has cleanly stopped.

#removeOnSignal

#waitForSignal

waitForSignal :: Signal -> Aff Signal

Just as onSignal, but Aff.

#isPortAvailable

#killProcessWithPort

killProcessWithPort :: UInt -> Aff Unit

Kill a process and wait for it to stop listening on a specific port.

#_rmdirSync

#FilePath

Modules