exitcode-0.3.0.1: Monad transformer for exit codes
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Process.CmdSpec

Synopsis

Documentation

data CmdSpec #

Constructors

ShellCommand String

A command line to execute using the shell

RawCommand FilePath [String]

The name of an executable with a list of arguments

The FilePath argument names the executable, and is interpreted according to the platform's standard policy for searching for executables. Specifically:

  • on Unix systems the execvp(3) semantics is used, where if the executable filename does not contain a slash (/) then the PATH environment variable is searched for the executable.
  • on Windows systems the Win32 CreateProcess semantics is used. Briefly: if the filename does not contain a path, then the directory containing the parent executable is searched, followed by the current directory, then some standard locations, and finally the current PATH. An .exe extension is added if the filename does not already have an extension. For full details see the documentation for the Windows SearchPath API.

Windows does not have a mechanism for passing multiple arguments. When using RawCommand on Windows, the command line is serialised into a string, with arguments quoted separately. Command line parsing is up individual programs, so the default behaviour may not work for some programs. If you are not getting the desired results, construct the command line yourself and use ShellCommand.

Instances

Instances details
IsString CmdSpec

construct a ShellCommand from a string literal

Since: process-1.2.1.0

Instance details

Defined in System.Process.Common

Methods

fromString :: String -> CmdSpec #

Show CmdSpec 
Instance details

Defined in System.Process.Common

AsCmdSpec CmdSpec Source #
>>> preview _ShellCommand (ShellCommand "ls -la")
Just "ls -la"
>>> preview _ShellCommand (RawCommand "ls" ["-la"])
Nothing
>>> preview _RawCommand (RawCommand "ls" ["-la"])
Just ("ls",["-la"])
>>> preview _RawCommand (ShellCommand "ls -la")
Nothing
>>> review _ShellCommand "echo hello" :: CmdSpec
ShellCommand "echo hello"
>>> review _RawCommand ("/bin/ls", ["-la"]) :: CmdSpec
RawCommand "/bin/ls" ["-la"]
Instance details

Defined in Control.Process.CmdSpec

GetCmdSpec CmdSpec Source #
>>> view getCmdSpec (ShellCommand "ls -la")
ShellCommand "ls -la"
Instance details

Defined in Control.Process.CmdSpec

HasCmdSpec CmdSpec Source #
>>> view cmdSpec (ShellCommand "ls")
ShellCommand "ls"
>>> set cmdSpec (RawCommand "echo" ["hi"]) (ShellCommand "ls")
RawCommand "echo" ["hi"]
Instance details

Defined in Control.Process.CmdSpec

ReviewCmdSpec CmdSpec Source #
>>> review reviewCmdSpec (ShellCommand "ls") :: CmdSpec
ShellCommand "ls"
Instance details

Defined in Control.Process.CmdSpec

Eq CmdSpec 
Instance details

Defined in System.Process.Common

Methods

(==) :: CmdSpec -> CmdSpec -> Bool #

(/=) :: CmdSpec -> CmdSpec -> Bool #

class GetCmdSpec a where Source #

Type class for values that can be viewed as a CmdSpec.

>>> view getCmdSpec (ShellCommand "ls -la")
ShellCommand "ls -la"

Instances

Instances details
GetCmdSpec CmdSpec Source #
>>> view getCmdSpec (ShellCommand "ls -la")
ShellCommand "ls -la"
Instance details

Defined in Control.Process.CmdSpec

GetCmdSpec CreateProcess Source #
>>> import System.Process (proc)
>>> view getCmdSpec (proc "echo" ["hello"])
RawCommand "echo" ["hello"]
Instance details

Defined in Control.Process.CmdSpec

class GetCmdSpec a => HasCmdSpec a where Source #

Type class for values with a lens into a CmdSpec.

>>> view cmdSpec (ShellCommand "ls -la")
ShellCommand "ls -la"

Minimal complete definition

cmdSpec

Instances

Instances details
HasCmdSpec CmdSpec Source #
>>> view cmdSpec (ShellCommand "ls")
ShellCommand "ls"
>>> set cmdSpec (RawCommand "echo" ["hi"]) (ShellCommand "ls")
RawCommand "echo" ["hi"]
Instance details

Defined in Control.Process.CmdSpec

HasCmdSpec CreateProcess Source #
>>> import System.Process (proc)
>>> view cmdSpec (proc "echo" ["hello"])
RawCommand "echo" ["hello"]
Instance details

Defined in Control.Process.CmdSpec

class ReviewCmdSpec a where Source #

Type class for values that can be constructed from a CmdSpec.

>>> review reviewCmdSpec (ShellCommand "ls") :: CmdSpec
ShellCommand "ls"

Instances

Instances details
ReviewCmdSpec CmdSpec Source #
>>> review reviewCmdSpec (ShellCommand "ls") :: CmdSpec
ShellCommand "ls"
Instance details

Defined in Control.Process.CmdSpec

class ReviewCmdSpec a => AsCmdSpec a where Source #

Type class for values with a prism into a CmdSpec.

>>> preview _CmdSpec (ShellCommand "ls -la")
Just (ShellCommand "ls -la")

Minimal complete definition

_CmdSpec

Instances

Instances details
AsCmdSpec CmdSpec Source #
>>> preview _ShellCommand (ShellCommand "ls -la")
Just "ls -la"
>>> preview _ShellCommand (RawCommand "ls" ["-la"])
Nothing
>>> preview _RawCommand (RawCommand "ls" ["-la"])
Just ("ls",["-la"])
>>> preview _RawCommand (ShellCommand "ls -la")
Nothing
>>> review _ShellCommand "echo hello" :: CmdSpec
ShellCommand "echo hello"
>>> review _RawCommand ("/bin/ls", ["-la"]) :: CmdSpec
RawCommand "/bin/ls" ["-la"]
Instance details

Defined in Control.Process.CmdSpec