Module

Ctl.Internal.Plutip.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 (String -> 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.

#waitForStop

waitForStop :: ManagedProcess -> Aff Unit

Waits until the process has cleanly stopped.

#removeOnSignal

Modules