Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.Subprocess
Contents
- Exported types
- Methods
- communicate
- communicateAsync
- communicateFinish
- communicateUtf8
- communicateUtf8Async
- communicateUtf8Finish
- forceExit
- getExitStatus
- getIdentifier
- getIfExited
- getIfSignaled
- getStatus
- getStderrPipe
- getStdinPipe
- getStdoutPipe
- getSuccessful
- getTermSig
- new
- sendSignal
- wait
- waitAsync
- waitCheck
- waitCheckAsync
- waitCheckFinish
- waitFinish
- Properties
Description
GSubprocess
allows the creation of and interaction with child
processes.
Processes can be communicated with using standard GIO-style APIs (ie:
InputStream
, OutputStream
). There are GIO-style APIs
to wait for process termination (ie: cancellable and with an asynchronous
variant).
There is an API to force a process to terminate, as well as a race-free API for sending UNIX signals to a subprocess.
One major advantage that GIO brings over the core GLib library is
comprehensive API for asynchronous I/O, such
outputStreamSpliceAsync
. This makes GSubprocess
significantly more powerful and flexible than equivalent APIs in
some other languages such as the subprocess.py
included with Python. For example, using GSubprocess
one could
create two child processes, reading standard output from the first,
processing it, and writing to the input stream of the second, all
without blocking the main loop.
A powerful subprocessCommunicate
API is provided similar to the
communicate()
method of subprocess.py
. This enables very easy
interaction with a subprocess that has been opened with pipes.
GSubprocess
defaults to tight control over the file descriptors open
in the child process, avoiding dangling-FD issues that are caused by
a simple fork()
/exec()
. The only open file descriptors in the
spawned process are ones that were explicitly specified by the
GSubprocess
API (unless G_SUBPROCESS_FLAGS_INHERIT_FDS
was
specified).
GSubprocess
will quickly reap all child processes as they exit,
avoiding ‘zombie processes’ remaining around for long periods of
time. subprocessWait
can be used to wait for this to happen,
but it will happen even without the call being explicitly made.
As a matter of principle, GSubprocess
has no API that accepts
shell-style space-separated strings. It will, however, match the
typical shell behaviour of searching the PATH
for executables that do
not contain a directory separator in their name. By default, the PATH
of the current process is used. You can specify
G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP
to use the PATH
of the
launcher environment instead.
GSubprocess
attempts to have a very simple API for most uses (ie:
spawning a subprocess with arguments and support for most typical
kinds of input and output redirection). See subprocessNew
. The
SubprocessLauncher
API is provided for more complicated cases
(advanced types of redirection, environment variable manipulation,
change of working directory, child setup functions, etc).
A typical use of GSubprocess
will involve calling
subprocessNew
, followed by subprocessWaitAsync
or
subprocessWait
. After the process exits, the status can be
checked using functions such as subprocessGetIfExited
(which
are similar to the familiar WIFEXITED
-style POSIX macros).
Note that as of GLib 2.82, creating a GSubprocess
causes the signal
SIGPIPE
to be ignored for the remainder of the program. If you are writing
a command-line utility that uses GSubprocess
, you may need to take into
account the fact that your program will not automatically be killed
if it tries to write to stdout
after it has been closed.
Since: 2.40
Synopsis
- newtype Subprocess = Subprocess (ManagedPtr Subprocess)
- class (GObject o, IsDescendantOf Subprocess o) => IsSubprocess o
- toSubprocess :: (MonadIO m, IsSubprocess o) => o -> m Subprocess
- type family ResolveSubprocessMethod (t :: Symbol) o where ...
- data SubprocessCommunicateMethodInfo
- subprocessCommunicate :: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) => a -> Maybe Bytes -> Maybe b -> m (Maybe Bytes, Maybe Bytes)
- data SubprocessCommunicateAsyncMethodInfo
- subprocessCommunicateAsync :: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) => a -> Maybe Bytes -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data SubprocessCommunicateFinishMethodInfo
- subprocessCommunicateFinish :: (HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) => a -> b -> m (Maybe Bytes, Maybe Bytes)
- data SubprocessCommunicateUtf8MethodInfo
- subprocessCommunicateUtf8 :: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) => a -> Maybe Text -> Maybe b -> m (Maybe Text, Maybe Text)
- data SubprocessCommunicateUtf8AsyncMethodInfo
- subprocessCommunicateUtf8Async :: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) => a -> Maybe Text -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data SubprocessCommunicateUtf8FinishMethodInfo
- subprocessCommunicateUtf8Finish :: (HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) => a -> b -> m (Maybe Text, Maybe Text)
- data SubprocessForceExitMethodInfo
- subprocessForceExit :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m ()
- data SubprocessGetExitStatusMethodInfo
- subprocessGetExitStatus :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m Int32
- data SubprocessGetIdentifierMethodInfo
- subprocessGetIdentifier :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m (Maybe Text)
- data SubprocessGetIfExitedMethodInfo
- subprocessGetIfExited :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m Bool
- data SubprocessGetIfSignaledMethodInfo
- subprocessGetIfSignaled :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m Bool
- data SubprocessGetStatusMethodInfo
- subprocessGetStatus :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m Int32
- data SubprocessGetStderrPipeMethodInfo
- subprocessGetStderrPipe :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m (Maybe InputStream)
- data SubprocessGetStdinPipeMethodInfo
- subprocessGetStdinPipe :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m (Maybe OutputStream)
- data SubprocessGetStdoutPipeMethodInfo
- subprocessGetStdoutPipe :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m (Maybe InputStream)
- data SubprocessGetSuccessfulMethodInfo
- subprocessGetSuccessful :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m Bool
- data SubprocessGetTermSigMethodInfo
- subprocessGetTermSig :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> m Int32
- subprocessNew :: (HasCallStack, MonadIO m) => [[Char]] -> [SubprocessFlags] -> m Subprocess
- data SubprocessSendSignalMethodInfo
- subprocessSendSignal :: (HasCallStack, MonadIO m, IsSubprocess a) => a -> Int32 -> m ()
- data SubprocessWaitMethodInfo
- subprocessWait :: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) => a -> Maybe b -> m ()
- data SubprocessWaitAsyncMethodInfo
- subprocessWaitAsync :: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data SubprocessWaitCheckMethodInfo
- subprocessWaitCheck :: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) => a -> Maybe b -> m ()
- data SubprocessWaitCheckAsyncMethodInfo
- subprocessWaitCheckAsync :: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- data SubprocessWaitCheckFinishMethodInfo
- subprocessWaitCheckFinish :: (HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) => a -> b -> m ()
- data SubprocessWaitFinishMethodInfo
- subprocessWaitFinish :: (HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) => a -> b -> m ()
- data SubprocessArgvPropertyInfo
- constructSubprocessArgv :: (IsSubprocess o, MonadIO m) => [Text] -> m (GValueConstruct o)
- subprocessArgv :: AttrLabelProxy "argv"
- data SubprocessFlagsPropertyInfo
- constructSubprocessFlags :: (IsSubprocess o, MonadIO m) => [SubprocessFlags] -> m (GValueConstruct o)
- subprocessFlags :: AttrLabelProxy "flags"
Exported types
newtype Subprocess Source #
Memory-managed wrapper type.
Constructors
Subprocess (ManagedPtr Subprocess) |
Instances
class (GObject o, IsDescendantOf Subprocess o) => IsSubprocess o Source #
Type class for types which can be safely cast to Subprocess
, for instance with toSubprocess
.
Instances
(GObject o, IsDescendantOf Subprocess o) => IsSubprocess o Source # | |
Defined in GI.Gio.Objects.Subprocess |
toSubprocess :: (MonadIO m, IsSubprocess o) => o -> m Subprocess Source #
Cast to Subprocess
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, communicate, communicateAsync, communicateFinish, communicateUtf8, communicateUtf8Async, communicateUtf8Finish, forceExit, forceFloating, freezeNotify, getv, init, isFloating, notify, notifyByPspec, ref, refSink, runDispose, sendSignal, stealData, stealQdata, thawNotify, unref, wait, waitAsync, waitCheck, waitCheckAsync, waitCheckFinish, waitFinish, watchClosure.
Getters
getData, getExitStatus, getIdentifier, getIfExited, getIfSignaled, getProperty, getQdata, getStatus, getStderrPipe, getStdinPipe, getStdoutPipe, getSuccessful, getTermSig.
Setters
type family ResolveSubprocessMethod (t :: Symbol) o where ... Source #
Equations
communicate
data SubprocessCommunicateMethodInfo Source #
Instances
(signature ~ (Maybe Bytes -> Maybe b -> m (Maybe Bytes, Maybe Bytes)), MonadIO m, IsSubprocess a, IsCancellable b) => OverloadedMethod SubprocessCommunicateMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessCommunicateMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessCommunicate Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) | |
=> a |
|
-> Maybe Bytes |
|
-> Maybe b |
|
-> m (Maybe Bytes, Maybe Bytes) | (Can throw |
Communicate with the subprocess until it terminates, and all input and output has been completed.
If stdinBuf
is given, the subprocess must have been created with
SubprocessFlagsStdinPipe
. The given data is fed to the
stdin of the subprocess and the pipe is closed (ie: EOF).
At the same time (as not to cause blocking when dealing with large
amounts of data), if SubprocessFlagsStdoutPipe
or
SubprocessFlagsStderrPipe
were used, reads from those
streams. The data that was read is returned in stdout
and/or
the stderr
.
If the subprocess was created with SubprocessFlagsStdoutPipe
,
stdoutBuf
will contain the data read from stdout. Otherwise, for
subprocesses not created with SubprocessFlagsStdoutPipe
,
stdoutBuf
will be set to Nothing
. Similar provisions apply to
stderrBuf
and SubprocessFlagsStderrPipe
.
As usual, any output variable may be given as Nothing
to ignore it.
If you desire the stdout and stderr data to be interleaved, create
the subprocess with SubprocessFlagsStdoutPipe
and
SubprocessFlagsStderrMerge
. The merged result will be returned
in stdoutBuf
and stderrBuf
will be set to Nothing
.
In case of any error (including cancellation), False
will be
returned with error
set. Some or all of the stdin data may have
been written. Any stdout or stderr data that has been read will be
discarded. None of the out variables (aside from error
) will have
been set to anything in particular and should not be inspected.
In the case that True
is returned, the subprocess has exited and the
exit status inspection APIs (eg: subprocessGetIfExited
,
subprocessGetExitStatus
) may be used.
You should not attempt to use any of the subprocess pipes after starting this function, since they may be left in strange states, even if the operation was cancelled. You should especially not attempt to interact with the pipes while the operation is in progress (either from another thread or if using the asynchronous version).
Since: 2.40
communicateAsync
data SubprocessCommunicateAsyncMethodInfo Source #
Instances
(signature ~ (Maybe Bytes -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsSubprocess a, IsCancellable b) => OverloadedMethod SubprocessCommunicateAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessCommunicateAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessCommunicateAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) | |
=> a |
|
-> Maybe Bytes |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronous version of subprocessCommunicate
. Complete
invocation with subprocessCommunicateFinish
.
communicateFinish
data SubprocessCommunicateFinishMethodInfo Source #
Instances
(signature ~ (b -> m (Maybe Bytes, Maybe Bytes)), MonadIO m, IsSubprocess a, IsAsyncResult b) => OverloadedMethod SubprocessCommunicateFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessCommunicateFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessCommunicateFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m (Maybe Bytes, Maybe Bytes) | (Can throw |
Complete an invocation of subprocessCommunicateAsync
.
communicateUtf8
data SubprocessCommunicateUtf8MethodInfo Source #
Instances
(signature ~ (Maybe Text -> Maybe b -> m (Maybe Text, Maybe Text)), MonadIO m, IsSubprocess a, IsCancellable b) => OverloadedMethod SubprocessCommunicateUtf8MethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessCommunicateUtf8MethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessCommunicateUtf8 Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) | |
=> a |
|
-> Maybe Text |
|
-> Maybe b |
|
-> m (Maybe Text, Maybe Text) | (Can throw |
Like subprocessCommunicate
, but validates the output of the
process as UTF-8, and returns it as a regular NUL terminated string.
On error, stdoutBuf
and stderrBuf
will be set to undefined values and
should not be used.
communicateUtf8Async
data SubprocessCommunicateUtf8AsyncMethodInfo Source #
Instances
(signature ~ (Maybe Text -> Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsSubprocess a, IsCancellable b) => OverloadedMethod SubprocessCommunicateUtf8AsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessCommunicateUtf8AsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessCommunicateUtf8Async Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) | |
=> a |
|
-> Maybe Text |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronous version of subprocessCommunicateUtf8
. Complete
invocation with subprocessCommunicateUtf8Finish
.
communicateUtf8Finish
data SubprocessCommunicateUtf8FinishMethodInfo Source #
Instances
(signature ~ (b -> m (Maybe Text, Maybe Text)), MonadIO m, IsSubprocess a, IsAsyncResult b) => OverloadedMethod SubprocessCommunicateUtf8FinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessCommunicateUtf8FinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessCommunicateUtf8Finish Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m (Maybe Text, Maybe Text) | (Can throw |
Complete an invocation of subprocessCommunicateUtf8Async
.
forceExit
data SubprocessForceExitMethodInfo Source #
Instances
(signature ~ m (), MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessForceExitMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessForceExitMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m () |
Use an operating-system specific method to attempt an immediate,
forceful termination of the process. There is no mechanism to
determine whether or not the request itself was successful;
however, you can use subprocessWait
to monitor the status of
the process after calling this function.
On Unix, this function sends SIGKILL
.
Since: 2.40
getExitStatus
data SubprocessGetExitStatusMethodInfo Source #
Instances
(signature ~ m Int32, MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetExitStatusMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetExitStatusMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessGetExitStatus Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m Int32 | Returns: the exit status |
Check the exit status of the subprocess, given that it exited
normally. This is the value passed to the exit()
system call or the
return value from main.
This is equivalent to the system WEXITSTATUS macro.
It is an error to call this function before subprocessWait
and
unless subprocessGetIfExited
returned True
.
Since: 2.40
getIdentifier
data SubprocessGetIdentifierMethodInfo Source #
Instances
(signature ~ m (Maybe Text), MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetIdentifierMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetIdentifierMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessGetIdentifier Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m (Maybe Text) | Returns: the subprocess identifier, or |
On UNIX, returns the process ID as a decimal string.
On Windows, returns the result of GetProcessId()
also as a string.
If the subprocess has terminated, this will return Nothing
.
Since: 2.40
getIfExited
data SubprocessGetIfExitedMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetIfExitedMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetIfExitedMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessGetIfExited Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m Bool | Returns: |
Check if the given subprocess exited normally (ie: by way of exit()
or return from main()
).
This is equivalent to the system WIFEXITED macro.
It is an error to call this function before subprocessWait
has
returned.
Since: 2.40
getIfSignaled
data SubprocessGetIfSignaledMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetIfSignaledMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetIfSignaledMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessGetIfSignaled Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m Bool | Returns: |
Check if the given subprocess terminated in response to a signal.
This is equivalent to the system WIFSIGNALED macro.
It is an error to call this function before subprocessWait
has
returned.
Since: 2.40
getStatus
data SubprocessGetStatusMethodInfo Source #
Instances
(signature ~ m Int32, MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetStatusMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetStatusMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m Int32 | Returns: the (meaningless) |
Gets the raw status code of the process, as from waitpid()
.
This value has no particular meaning, but it can be used with the
macros defined by the system headers such as WIFEXITED. It can also
be used with spawnCheckWaitStatus
.
It is more likely that you want to use subprocessGetIfExited
followed by subprocessGetExitStatus
.
It is an error to call this function before subprocessWait
has
returned.
Since: 2.40
getStderrPipe
data SubprocessGetStderrPipeMethodInfo Source #
Instances
(signature ~ m (Maybe InputStream), MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetStderrPipeMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetStderrPipeMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessGetStderrPipe Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m (Maybe InputStream) | Returns: the stderr pipe |
Gets the InputStream
from which to read the stderr output of
subprocess
.
The process must have been created with SubprocessFlagsStderrPipe
,
otherwise Nothing
will be returned.
Since: 2.40
getStdinPipe
data SubprocessGetStdinPipeMethodInfo Source #
Instances
(signature ~ m (Maybe OutputStream), MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetStdinPipeMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetStdinPipeMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessGetStdinPipe Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m (Maybe OutputStream) | Returns: the stdout pipe |
Gets the OutputStream
that you can write to in order to give data
to the stdin of subprocess
.
The process must have been created with SubprocessFlagsStdinPipe
and
not SubprocessFlagsStdinInherit
, otherwise Nothing
will be returned.
Since: 2.40
getStdoutPipe
data SubprocessGetStdoutPipeMethodInfo Source #
Instances
(signature ~ m (Maybe InputStream), MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetStdoutPipeMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetStdoutPipeMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessGetStdoutPipe Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m (Maybe InputStream) | Returns: the stdout pipe |
Gets the InputStream
from which to read the stdout output of
subprocess
.
The process must have been created with SubprocessFlagsStdoutPipe
,
otherwise Nothing
will be returned.
Since: 2.40
getSuccessful
data SubprocessGetSuccessfulMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetSuccessfulMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetSuccessfulMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessGetSuccessful Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m Bool | Returns: |
Checks if the process was "successful". A process is considered
successful if it exited cleanly with an exit status of 0, either by
way of the exit()
system call or return from main()
.
It is an error to call this function before subprocessWait
has
returned.
Since: 2.40
getTermSig
data SubprocessGetTermSigMethodInfo Source #
Instances
(signature ~ m Int32, MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessGetTermSigMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessGetTermSigMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> m Int32 | Returns: the signal causing termination |
Get the signal number that caused the subprocess to terminate, given that it terminated due to a signal.
This is equivalent to the system WTERMSIG macro.
It is an error to call this function before subprocessWait
and
unless subprocessGetIfSignaled
returned True
.
Since: 2.40
new
Arguments
:: (HasCallStack, MonadIO m) | |
=> [[Char]] |
|
-> [SubprocessFlags] |
|
-> m Subprocess | Returns: A newly created |
Create a new process with the given flags and argument list.
The argument list is expected to be Nothing
-terminated.
Since: 2.40
sendSignal
data SubprocessSendSignalMethodInfo Source #
Instances
(signature ~ (Int32 -> m ()), MonadIO m, IsSubprocess a) => OverloadedMethod SubprocessSendSignalMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessSendSignalMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a) | |
=> a |
|
-> Int32 |
|
-> m () |
Sends the UNIX signal signalNum
to the subprocess, if it is still
running.
This API is race-free. If the subprocess has terminated, it will not be signalled.
This API is not available on Windows.
Since: 2.40
wait
data SubprocessWaitMethodInfo Source #
Instances
(signature ~ (Maybe b -> m ()), MonadIO m, IsSubprocess a, IsCancellable b) => OverloadedMethod SubprocessWaitMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessWaitMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Synchronously wait for the subprocess to terminate.
After the process terminates you can query its exit status with
functions such as subprocessGetIfExited
and
subprocessGetExitStatus
.
This function does not fail in the case of the subprocess having
abnormal termination. See subprocessWaitCheck
for that.
Cancelling cancellable
doesn't kill the subprocess. Call
subprocessForceExit
if it is desirable.
Since: 2.40
waitAsync
data SubprocessWaitAsyncMethodInfo Source #
Instances
(signature ~ (Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsSubprocess a, IsCancellable b) => OverloadedMethod SubprocessWaitAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessWaitAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
waitCheck
data SubprocessWaitCheckMethodInfo Source #
Instances
(signature ~ (Maybe b -> m ()), MonadIO m, IsSubprocess a, IsCancellable b) => OverloadedMethod SubprocessWaitCheckMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessWaitCheckMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m () | (Can throw |
Combines subprocessWait
with spawnCheckWaitStatus
.
Since: 2.40
waitCheckAsync
data SubprocessWaitCheckAsyncMethodInfo Source #
Instances
(signature ~ (Maybe b -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsSubprocess a, IsCancellable b) => OverloadedMethod SubprocessWaitCheckAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessWaitCheckAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessWaitCheckAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Combines subprocessWaitAsync
with spawnCheckWaitStatus
.
This is the asynchronous version of subprocessWaitCheck
.
Since: 2.40
waitCheckFinish
data SubprocessWaitCheckFinishMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsSubprocess a, IsAsyncResult b) => OverloadedMethod SubprocessWaitCheckFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessWaitCheckFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
subprocessWaitCheckFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Collects the result of a previous call to
subprocessWaitCheckAsync
.
Since: 2.40
waitFinish
data SubprocessWaitFinishMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsSubprocess a, IsAsyncResult b) => OverloadedMethod SubprocessWaitFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.Subprocess Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SubprocessWaitFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.Subprocess Methods |
Arguments
:: (HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Collects the result of a previous call to
subprocessWaitAsync
.
Since: 2.40
Properties
argv
Argument vector.
Since: 2.40
data SubprocessArgvPropertyInfo Source #
Instances
constructSubprocessArgv :: (IsSubprocess o, MonadIO m) => [Text] -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “argv
” property. This is rarely needed directly, but it is used by new
.
subprocessArgv :: AttrLabelProxy "argv" Source #
flags
Subprocess flags.
Since: 2.40
data SubprocessFlagsPropertyInfo Source #
Instances
AttrInfo SubprocessFlagsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Subprocess Associated Types
Methods attrGet :: AttrBaseTypeConstraint SubprocessFlagsPropertyInfo o => o -> IO (AttrGetType SubprocessFlagsPropertyInfo) # attrSet :: (AttrBaseTypeConstraint SubprocessFlagsPropertyInfo o, AttrSetTypeConstraint SubprocessFlagsPropertyInfo b) => o -> b -> IO () # attrClear :: AttrBaseTypeConstraint SubprocessFlagsPropertyInfo o => o -> IO () # attrConstruct :: (AttrBaseTypeConstraint SubprocessFlagsPropertyInfo o, AttrSetTypeConstraint SubprocessFlagsPropertyInfo b) => b -> IO (GValueConstruct o) # attrTransfer :: (AttrBaseTypeConstraint SubprocessFlagsPropertyInfo o, AttrTransferTypeConstraint SubprocessFlagsPropertyInfo b) => Proxy o -> b -> IO (AttrTransferType SubprocessFlagsPropertyInfo) # | |||||||||||||||||||||||||||||||||
type AttrAllowedOps SubprocessFlagsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Subprocess | |||||||||||||||||||||||||||||||||
type AttrBaseTypeConstraint SubprocessFlagsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
type AttrGetType SubprocessFlagsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Subprocess | |||||||||||||||||||||||||||||||||
type AttrLabel SubprocessFlagsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Subprocess | |||||||||||||||||||||||||||||||||
type AttrOrigin SubprocessFlagsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Subprocess | |||||||||||||||||||||||||||||||||
type AttrSetTypeConstraint SubprocessFlagsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Subprocess | |||||||||||||||||||||||||||||||||
type AttrTransferType SubprocessFlagsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Subprocess | |||||||||||||||||||||||||||||||||
type AttrTransferTypeConstraint SubprocessFlagsPropertyInfo Source # | |||||||||||||||||||||||||||||||||
Defined in GI.Gio.Objects.Subprocess |
constructSubprocessFlags :: (IsSubprocess o, MonadIO m) => [SubprocessFlags] -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “flags
” property. This is rarely needed directly, but it is used by new
.
subprocessFlags :: AttrLabelProxy "flags" Source #