{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.Gio.Objects.Subprocess.Subprocess' allows the creation of and interaction with child
-- processes.
-- 
-- Processes can be communicated with using standard GIO-style APIs (ie:
-- t'GI.Gio.Objects.InputStream.InputStream', t'GI.Gio.Objects.OutputStream.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
-- 'GI.Gio.Objects.OutputStream.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 t'GI.Gio.Objects.Subprocess.Subprocess' 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 'GI.Gio.Objects.Subprocess.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.
-- 
-- t'GI.Gio.Objects.Subprocess.Subprocess' 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
-- t'GI.Gio.Objects.Subprocess.Subprocess' API (unless 'GI.Gio.Flags.SubprocessFlagsInheritFds' was
-- specified).
-- 
-- t'GI.Gio.Objects.Subprocess.Subprocess' will quickly reap all child processes as they exit,
-- avoiding \"zombie processes\" remaining around for long periods of
-- time.  'GI.Gio.Objects.Subprocess.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, t'GI.Gio.Objects.Subprocess.Subprocess' 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
-- 'GI.Gio.Flags.SubprocessFlagsSearchPathFromEnvp' to use the @PATH@ of the
-- launcher environment instead.
-- 
-- t'GI.Gio.Objects.Subprocess.Subprocess' 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 @/g_subprocess_new()/@. The
-- t'GI.Gio.Objects.SubprocessLauncher.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 t'GI.Gio.Objects.Subprocess.Subprocess' will involve calling
-- @/g_subprocess_new()/@, followed by 'GI.Gio.Objects.Subprocess.subprocessWaitAsync' or
-- 'GI.Gio.Objects.Subprocess.subprocessWait'.  After the process exits, the status can be
-- checked using functions such as 'GI.Gio.Objects.Subprocess.subprocessGetIfExited' (which
-- are similar to the familiar WIFEXITED-style POSIX macros).
-- 
-- /Since: 2.40/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gio.Objects.Subprocess
    ( 

-- * Exported types
    Subprocess(..)                          ,
    IsSubprocess                            ,
    toSubprocess                            ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [communicate]("GI.Gio.Objects.Subprocess#g:method:communicate"), [communicateAsync]("GI.Gio.Objects.Subprocess#g:method:communicateAsync"), [communicateFinish]("GI.Gio.Objects.Subprocess#g:method:communicateFinish"), [communicateUtf8]("GI.Gio.Objects.Subprocess#g:method:communicateUtf8"), [communicateUtf8Async]("GI.Gio.Objects.Subprocess#g:method:communicateUtf8Async"), [communicateUtf8Finish]("GI.Gio.Objects.Subprocess#g:method:communicateUtf8Finish"), [forceExit]("GI.Gio.Objects.Subprocess#g:method:forceExit"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [init]("GI.Gio.Interfaces.Initable#g:method:init"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [sendSignal]("GI.Gio.Objects.Subprocess#g:method:sendSignal"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [wait]("GI.Gio.Objects.Subprocess#g:method:wait"), [waitAsync]("GI.Gio.Objects.Subprocess#g:method:waitAsync"), [waitCheck]("GI.Gio.Objects.Subprocess#g:method:waitCheck"), [waitCheckAsync]("GI.Gio.Objects.Subprocess#g:method:waitCheckAsync"), [waitCheckFinish]("GI.Gio.Objects.Subprocess#g:method:waitCheckFinish"), [waitFinish]("GI.Gio.Objects.Subprocess#g:method:waitFinish"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getExitStatus]("GI.Gio.Objects.Subprocess#g:method:getExitStatus"), [getIdentifier]("GI.Gio.Objects.Subprocess#g:method:getIdentifier"), [getIfExited]("GI.Gio.Objects.Subprocess#g:method:getIfExited"), [getIfSignaled]("GI.Gio.Objects.Subprocess#g:method:getIfSignaled"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getStatus]("GI.Gio.Objects.Subprocess#g:method:getStatus"), [getStderrPipe]("GI.Gio.Objects.Subprocess#g:method:getStderrPipe"), [getStdinPipe]("GI.Gio.Objects.Subprocess#g:method:getStdinPipe"), [getStdoutPipe]("GI.Gio.Objects.Subprocess#g:method:getStdoutPipe"), [getSuccessful]("GI.Gio.Objects.Subprocess#g:method:getSuccessful"), [getTermSig]("GI.Gio.Objects.Subprocess#g:method:getTermSig").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveSubprocessMethod                 ,
#endif

-- ** communicate #method:communicate#

#if defined(ENABLE_OVERLOADING)
    SubprocessCommunicateMethodInfo         ,
#endif
    subprocessCommunicate                   ,


-- ** communicateAsync #method:communicateAsync#

#if defined(ENABLE_OVERLOADING)
    SubprocessCommunicateAsyncMethodInfo    ,
#endif
    subprocessCommunicateAsync              ,


-- ** communicateFinish #method:communicateFinish#

#if defined(ENABLE_OVERLOADING)
    SubprocessCommunicateFinishMethodInfo   ,
#endif
    subprocessCommunicateFinish             ,


-- ** communicateUtf8 #method:communicateUtf8#

#if defined(ENABLE_OVERLOADING)
    SubprocessCommunicateUtf8MethodInfo     ,
#endif
    subprocessCommunicateUtf8               ,


-- ** communicateUtf8Async #method:communicateUtf8Async#

#if defined(ENABLE_OVERLOADING)
    SubprocessCommunicateUtf8AsyncMethodInfo,
#endif
    subprocessCommunicateUtf8Async          ,


-- ** communicateUtf8Finish #method:communicateUtf8Finish#

#if defined(ENABLE_OVERLOADING)
    SubprocessCommunicateUtf8FinishMethodInfo,
#endif
    subprocessCommunicateUtf8Finish         ,


-- ** forceExit #method:forceExit#

#if defined(ENABLE_OVERLOADING)
    SubprocessForceExitMethodInfo           ,
#endif
    subprocessForceExit                     ,


-- ** getExitStatus #method:getExitStatus#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetExitStatusMethodInfo       ,
#endif
    subprocessGetExitStatus                 ,


-- ** getIdentifier #method:getIdentifier#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetIdentifierMethodInfo       ,
#endif
    subprocessGetIdentifier                 ,


-- ** getIfExited #method:getIfExited#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetIfExitedMethodInfo         ,
#endif
    subprocessGetIfExited                   ,


-- ** getIfSignaled #method:getIfSignaled#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetIfSignaledMethodInfo       ,
#endif
    subprocessGetIfSignaled                 ,


-- ** getStatus #method:getStatus#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetStatusMethodInfo           ,
#endif
    subprocessGetStatus                     ,


-- ** getStderrPipe #method:getStderrPipe#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetStderrPipeMethodInfo       ,
#endif
    subprocessGetStderrPipe                 ,


-- ** getStdinPipe #method:getStdinPipe#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetStdinPipeMethodInfo        ,
#endif
    subprocessGetStdinPipe                  ,


-- ** getStdoutPipe #method:getStdoutPipe#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetStdoutPipeMethodInfo       ,
#endif
    subprocessGetStdoutPipe                 ,


-- ** getSuccessful #method:getSuccessful#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetSuccessfulMethodInfo       ,
#endif
    subprocessGetSuccessful                 ,


-- ** getTermSig #method:getTermSig#

#if defined(ENABLE_OVERLOADING)
    SubprocessGetTermSigMethodInfo          ,
#endif
    subprocessGetTermSig                    ,


-- ** new #method:new#

    subprocessNew                           ,


-- ** sendSignal #method:sendSignal#

#if defined(ENABLE_OVERLOADING)
    SubprocessSendSignalMethodInfo          ,
#endif
    subprocessSendSignal                    ,


-- ** wait #method:wait#

#if defined(ENABLE_OVERLOADING)
    SubprocessWaitMethodInfo                ,
#endif
    subprocessWait                          ,


-- ** waitAsync #method:waitAsync#

#if defined(ENABLE_OVERLOADING)
    SubprocessWaitAsyncMethodInfo           ,
#endif
    subprocessWaitAsync                     ,


-- ** waitCheck #method:waitCheck#

#if defined(ENABLE_OVERLOADING)
    SubprocessWaitCheckMethodInfo           ,
#endif
    subprocessWaitCheck                     ,


-- ** waitCheckAsync #method:waitCheckAsync#

#if defined(ENABLE_OVERLOADING)
    SubprocessWaitCheckAsyncMethodInfo      ,
#endif
    subprocessWaitCheckAsync                ,


-- ** waitCheckFinish #method:waitCheckFinish#

#if defined(ENABLE_OVERLOADING)
    SubprocessWaitCheckFinishMethodInfo     ,
#endif
    subprocessWaitCheckFinish               ,


-- ** waitFinish #method:waitFinish#

#if defined(ENABLE_OVERLOADING)
    SubprocessWaitFinishMethodInfo          ,
#endif
    subprocessWaitFinish                    ,




 -- * Properties


-- ** argv #attr:argv#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    SubprocessArgvPropertyInfo              ,
#endif
    constructSubprocessArgv                 ,
#if defined(ENABLE_OVERLOADING)
    subprocessArgv                          ,
#endif


-- ** flags #attr:flags#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    SubprocessFlagsPropertyInfo             ,
#endif
    constructSubprocessFlags                ,
#if defined(ENABLE_OVERLOADING)
    subprocessFlags                         ,
#endif




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Initable as Gio.Initable
import {-# SOURCE #-} qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Gio.Objects.InputStream as Gio.InputStream
import {-# SOURCE #-} qualified GI.Gio.Objects.OutputStream as Gio.OutputStream

-- | Memory-managed wrapper type.
newtype Subprocess = Subprocess (SP.ManagedPtr Subprocess)
    deriving (Subprocess -> Subprocess -> Bool
(Subprocess -> Subprocess -> Bool)
-> (Subprocess -> Subprocess -> Bool) -> Eq Subprocess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Subprocess -> Subprocess -> Bool
== :: Subprocess -> Subprocess -> Bool
$c/= :: Subprocess -> Subprocess -> Bool
/= :: Subprocess -> Subprocess -> Bool
Eq)

instance SP.ManagedPtrNewtype Subprocess where
    toManagedPtr :: Subprocess -> ManagedPtr Subprocess
toManagedPtr (Subprocess ManagedPtr Subprocess
p) = ManagedPtr Subprocess
p

foreign import ccall "g_subprocess_get_type"
    c_g_subprocess_get_type :: IO B.Types.GType

instance B.Types.TypedObject Subprocess where
    glibType :: IO GType
glibType = IO GType
c_g_subprocess_get_type

instance B.Types.GObject Subprocess

-- | Type class for types which can be safely cast to `Subprocess`, for instance with `toSubprocess`.
class (SP.GObject o, O.IsDescendantOf Subprocess o) => IsSubprocess o
instance (SP.GObject o, O.IsDescendantOf Subprocess o) => IsSubprocess o

instance O.HasParentTypes Subprocess
type instance O.ParentTypes Subprocess = '[GObject.Object.Object, Gio.Initable.Initable]

-- | Cast to `Subprocess`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toSubprocess :: (MIO.MonadIO m, IsSubprocess o) => o -> m Subprocess
toSubprocess :: forall (m :: * -> *) o.
(MonadIO m, IsSubprocess o) =>
o -> m Subprocess
toSubprocess = IO Subprocess -> m Subprocess
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Subprocess -> m Subprocess)
-> (o -> IO Subprocess) -> o -> m Subprocess
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Subprocess -> Subprocess) -> o -> IO Subprocess
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Subprocess -> Subprocess
Subprocess

-- | Convert 'Subprocess' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Subprocess) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_subprocess_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Subprocess -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Subprocess
P.Nothing = Ptr GValue -> Ptr Subprocess -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Subprocess
forall a. Ptr a
FP.nullPtr :: FP.Ptr Subprocess)
    gvalueSet_ Ptr GValue
gv (P.Just Subprocess
obj) = Subprocess -> (Ptr Subprocess -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Subprocess
obj (Ptr GValue -> Ptr Subprocess -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Subprocess)
gvalueGet_ Ptr GValue
gv = do
        Ptr Subprocess
ptr <- Ptr GValue -> IO (Ptr Subprocess)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Subprocess)
        if Ptr Subprocess
ptr Ptr Subprocess -> Ptr Subprocess -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Subprocess
forall a. Ptr a
FP.nullPtr
        then Subprocess -> Maybe Subprocess
forall a. a -> Maybe a
P.Just (Subprocess -> Maybe Subprocess)
-> IO Subprocess -> IO (Maybe Subprocess)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Subprocess -> Subprocess)
-> Ptr Subprocess -> IO Subprocess
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Subprocess -> Subprocess
Subprocess Ptr Subprocess
ptr
        else Maybe Subprocess -> IO (Maybe Subprocess)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Subprocess
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveSubprocessMethod (t :: Symbol) (o :: *) :: * where
    ResolveSubprocessMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSubprocessMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSubprocessMethod "communicate" o = SubprocessCommunicateMethodInfo
    ResolveSubprocessMethod "communicateAsync" o = SubprocessCommunicateAsyncMethodInfo
    ResolveSubprocessMethod "communicateFinish" o = SubprocessCommunicateFinishMethodInfo
    ResolveSubprocessMethod "communicateUtf8" o = SubprocessCommunicateUtf8MethodInfo
    ResolveSubprocessMethod "communicateUtf8Async" o = SubprocessCommunicateUtf8AsyncMethodInfo
    ResolveSubprocessMethod "communicateUtf8Finish" o = SubprocessCommunicateUtf8FinishMethodInfo
    ResolveSubprocessMethod "forceExit" o = SubprocessForceExitMethodInfo
    ResolveSubprocessMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSubprocessMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSubprocessMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveSubprocessMethod "init" o = Gio.Initable.InitableInitMethodInfo
    ResolveSubprocessMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSubprocessMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSubprocessMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSubprocessMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSubprocessMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSubprocessMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSubprocessMethod "sendSignal" o = SubprocessSendSignalMethodInfo
    ResolveSubprocessMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSubprocessMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSubprocessMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSubprocessMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSubprocessMethod "wait" o = SubprocessWaitMethodInfo
    ResolveSubprocessMethod "waitAsync" o = SubprocessWaitAsyncMethodInfo
    ResolveSubprocessMethod "waitCheck" o = SubprocessWaitCheckMethodInfo
    ResolveSubprocessMethod "waitCheckAsync" o = SubprocessWaitCheckAsyncMethodInfo
    ResolveSubprocessMethod "waitCheckFinish" o = SubprocessWaitCheckFinishMethodInfo
    ResolveSubprocessMethod "waitFinish" o = SubprocessWaitFinishMethodInfo
    ResolveSubprocessMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSubprocessMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSubprocessMethod "getExitStatus" o = SubprocessGetExitStatusMethodInfo
    ResolveSubprocessMethod "getIdentifier" o = SubprocessGetIdentifierMethodInfo
    ResolveSubprocessMethod "getIfExited" o = SubprocessGetIfExitedMethodInfo
    ResolveSubprocessMethod "getIfSignaled" o = SubprocessGetIfSignaledMethodInfo
    ResolveSubprocessMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSubprocessMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSubprocessMethod "getStatus" o = SubprocessGetStatusMethodInfo
    ResolveSubprocessMethod "getStderrPipe" o = SubprocessGetStderrPipeMethodInfo
    ResolveSubprocessMethod "getStdinPipe" o = SubprocessGetStdinPipeMethodInfo
    ResolveSubprocessMethod "getStdoutPipe" o = SubprocessGetStdoutPipeMethodInfo
    ResolveSubprocessMethod "getSuccessful" o = SubprocessGetSuccessfulMethodInfo
    ResolveSubprocessMethod "getTermSig" o = SubprocessGetTermSigMethodInfo
    ResolveSubprocessMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSubprocessMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveSubprocessMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSubprocessMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSubprocessMethod t Subprocess, O.OverloadedMethod info Subprocess p) => OL.IsLabel t (Subprocess -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveSubprocessMethod t Subprocess, O.OverloadedMethod info Subprocess p, R.HasField t Subprocess p) => R.HasField t Subprocess p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveSubprocessMethod t Subprocess, O.OverloadedMethodInfo info Subprocess) => OL.IsLabel t (O.MethodProxy info Subprocess) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- VVV Prop "argv"
   -- Type: TCArray True (-1) (-1) (TBasicType TUTF8)
   -- Flags: [PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Construct a `GValueConstruct` with valid value for the “@argv@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSubprocessArgv :: (IsSubprocess o, MIO.MonadIO m) => [T.Text] -> m (GValueConstruct o)
constructSubprocessArgv :: forall o (m :: * -> *).
(IsSubprocess o, MonadIO m) =>
[Text] -> m (GValueConstruct o)
constructSubprocessArgv [Text]
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe [Text] -> IO (GValueConstruct o)
forall o. String -> Maybe [Text] -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyStringArray String
"argv" ([Text] -> Maybe [Text]
forall a. a -> Maybe a
P.Just [Text]
val)

#if defined(ENABLE_OVERLOADING)
data SubprocessArgvPropertyInfo
instance AttrInfo SubprocessArgvPropertyInfo where
    type AttrAllowedOps SubprocessArgvPropertyInfo = '[ 'AttrConstruct, 'AttrClear]
    type AttrBaseTypeConstraint SubprocessArgvPropertyInfo = IsSubprocess
    type AttrSetTypeConstraint SubprocessArgvPropertyInfo = (~) [T.Text]
    type AttrTransferTypeConstraint SubprocessArgvPropertyInfo = (~) [T.Text]
    type AttrTransferType SubprocessArgvPropertyInfo = [T.Text]
    type AttrGetType SubprocessArgvPropertyInfo = ()
    type AttrLabel SubprocessArgvPropertyInfo = "argv"
    type AttrOrigin SubprocessArgvPropertyInfo = Subprocess
    attrGet = undefined
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructSubprocessArgv
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.argv"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#g:attr:argv"
        })
#endif

-- VVV Prop "flags"
   -- Type: TInterface (Name {namespace = "Gio", name = "SubprocessFlags"})
   -- Flags: [PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

-- | Construct a `GValueConstruct` with valid value for the “@flags@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructSubprocessFlags :: (IsSubprocess o, MIO.MonadIO m) => [Gio.Flags.SubprocessFlags] -> m (GValueConstruct o)
constructSubprocessFlags :: forall o (m :: * -> *).
(IsSubprocess o, MonadIO m) =>
[SubprocessFlags] -> m (GValueConstruct o)
constructSubprocessFlags [SubprocessFlags]
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> [SubprocessFlags] -> IO (GValueConstruct o)
forall a o.
(IsGFlag a, BoxedFlags a) =>
String -> [a] -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyFlags String
"flags" [SubprocessFlags]
val

#if defined(ENABLE_OVERLOADING)
data SubprocessFlagsPropertyInfo
instance AttrInfo SubprocessFlagsPropertyInfo where
    type AttrAllowedOps SubprocessFlagsPropertyInfo = '[ 'AttrConstruct]
    type AttrBaseTypeConstraint SubprocessFlagsPropertyInfo = IsSubprocess
    type AttrSetTypeConstraint SubprocessFlagsPropertyInfo = (~) [Gio.Flags.SubprocessFlags]
    type AttrTransferTypeConstraint SubprocessFlagsPropertyInfo = (~) [Gio.Flags.SubprocessFlags]
    type AttrTransferType SubprocessFlagsPropertyInfo = [Gio.Flags.SubprocessFlags]
    type AttrGetType SubprocessFlagsPropertyInfo = ()
    type AttrLabel SubprocessFlagsPropertyInfo = "flags"
    type AttrOrigin SubprocessFlagsPropertyInfo = Subprocess
    attrGet = undefined
    attrSet = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructSubprocessFlags
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.flags"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#g:attr:flags"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Subprocess
type instance O.AttributeList Subprocess = SubprocessAttributeList
type SubprocessAttributeList = ('[ '("argv", SubprocessArgvPropertyInfo), '("flags", SubprocessFlagsPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
subprocessArgv :: AttrLabelProxy "argv"
subprocessArgv = AttrLabelProxy

subprocessFlags :: AttrLabelProxy "flags"
subprocessFlags = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Subprocess = SubprocessSignalList
type SubprocessSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Subprocess::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "argv"
--           , argType = TCArray True (-1) (-1) (TBasicType TFileName)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "commandline arguments for the subprocess"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "SubprocessFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "flags that define the behaviour of the subprocess"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "Subprocess" })
-- throws : True
-- Skip return : False

foreign import ccall "g_subprocess_newv" g_subprocess_newv :: 
    Ptr CString ->                          -- argv : TCArray True (-1) (-1) (TBasicType TFileName)
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "SubprocessFlags"})
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Subprocess)

-- | Create a new process with the given flags and argument list.
-- 
-- The argument list is expected to be 'P.Nothing'-terminated.
-- 
-- /Since: 2.40/
subprocessNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [[Char]]
    -- ^ /@argv@/: commandline arguments for the subprocess
    -> [Gio.Flags.SubprocessFlags]
    -- ^ /@flags@/: flags that define the behaviour of the subprocess
    -> m Subprocess
    -- ^ __Returns:__ A newly created t'GI.Gio.Objects.Subprocess.Subprocess', or 'P.Nothing' on error (and /@error@/
    --   will be set) /(Can throw 'Data.GI.Base.GError.GError')/
subprocessNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[String] -> [SubprocessFlags] -> m Subprocess
subprocessNew [String]
argv [SubprocessFlags]
flags = IO Subprocess -> m Subprocess
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Subprocess -> m Subprocess) -> IO Subprocess -> m Subprocess
forall a b. (a -> b) -> a -> b
$ do
    Ptr CString
argv' <- [String] -> IO (Ptr CString)
packZeroTerminatedFileNameArray [String]
argv
    let flags' :: CUInt
flags' = [SubprocessFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [SubprocessFlags]
flags
    IO Subprocess -> IO () -> IO Subprocess
forall a b. IO a -> IO b -> IO a
onException (do
        Ptr Subprocess
result <- (Ptr (Ptr GError) -> IO (Ptr Subprocess)) -> IO (Ptr Subprocess)
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO (Ptr Subprocess)) -> IO (Ptr Subprocess))
-> (Ptr (Ptr GError) -> IO (Ptr Subprocess)) -> IO (Ptr Subprocess)
forall a b. (a -> b) -> a -> b
$ Ptr CString -> CUInt -> Ptr (Ptr GError) -> IO (Ptr Subprocess)
g_subprocess_newv Ptr CString
argv' CUInt
flags'
        Text -> Ptr Subprocess -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"subprocessNew" Ptr Subprocess
result
        Subprocess
result' <- ((ManagedPtr Subprocess -> Subprocess)
-> Ptr Subprocess -> IO Subprocess
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Subprocess -> Subprocess
Subprocess) Ptr Subprocess
result
        (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
argv'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
argv'
        Subprocess -> IO Subprocess
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Subprocess
result'
     ) (do
        (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
argv'
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
argv'
     )

#if defined(ENABLE_OVERLOADING)
#endif

-- method Subprocess::communicate
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stdin_buf"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "data to send to the stdin of the subprocess, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stdout_buf"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data read from the subprocess stdout"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "stderr_buf"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data read from the subprocess stderr"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_subprocess_communicate" g_subprocess_communicate :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr GLib.Bytes.Bytes ->                 -- stdin_buf : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GLib.Bytes.Bytes) ->           -- stdout_buf : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr (Ptr GLib.Bytes.Bytes) ->           -- stderr_buf : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | 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
-- 'GI.Gio.Flags.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 'GI.Gio.Flags.SubprocessFlagsStdoutPipe' or
-- 'GI.Gio.Flags.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 'GI.Gio.Flags.SubprocessFlagsStdoutPipe',
-- /@stdoutBuf@/ will contain the data read from stdout.  Otherwise, for
-- subprocesses not created with 'GI.Gio.Flags.SubprocessFlagsStdoutPipe',
-- /@stdoutBuf@/ will be set to 'P.Nothing'.  Similar provisions apply to
-- /@stderrBuf@/ and 'GI.Gio.Flags.SubprocessFlagsStderrPipe'.
-- 
-- As usual, any output variable may be given as 'P.Nothing' to ignore it.
-- 
-- If you desire the stdout and stderr data to be interleaved, create
-- the subprocess with 'GI.Gio.Flags.SubprocessFlagsStdoutPipe' and
-- 'GI.Gio.Flags.SubprocessFlagsStderrMerge'.  The merged result will be returned
-- in /@stdoutBuf@/ and /@stderrBuf@/ will be set to 'P.Nothing'.
-- 
-- In case of any error (including cancellation), 'P.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 'P.True' is returned, the subprocess has exited and the
-- exit status inspection APIs (eg: 'GI.Gio.Objects.Subprocess.subprocessGetIfExited',
-- 'GI.Gio.Objects.Subprocess.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/
subprocessCommunicate ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> Maybe (GLib.Bytes.Bytes)
    -- ^ /@stdinBuf@/: data to send to the stdin of the subprocess, or 'P.Nothing'
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable'
    -> m ((Maybe GLib.Bytes.Bytes, Maybe GLib.Bytes.Bytes))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
subprocessCommunicate :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) =>
a -> Maybe Bytes -> Maybe b -> m (Maybe Bytes, Maybe Bytes)
subprocessCommunicate a
subprocess Maybe Bytes
stdinBuf Maybe b
cancellable = IO (Maybe Bytes, Maybe Bytes) -> m (Maybe Bytes, Maybe Bytes)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Bytes, Maybe Bytes) -> m (Maybe Bytes, Maybe Bytes))
-> IO (Maybe Bytes, Maybe Bytes) -> m (Maybe Bytes, Maybe Bytes)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr Bytes
maybeStdinBuf <- case Maybe Bytes
stdinBuf of
        Maybe Bytes
Nothing -> Ptr Bytes -> IO (Ptr Bytes)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Bytes
forall a. Ptr a
nullPtr
        Just Bytes
jStdinBuf -> do
            Ptr Bytes
jStdinBuf' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
jStdinBuf
            Ptr Bytes -> IO (Ptr Bytes)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Bytes
jStdinBuf'
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    Ptr (Ptr Bytes)
stdoutBuf <- IO (Ptr (Ptr Bytes))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr GLib.Bytes.Bytes))
    Ptr (Ptr Bytes)
stderrBuf <- IO (Ptr (Ptr Bytes))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr GLib.Bytes.Bytes))
    IO (Maybe Bytes, Maybe Bytes)
-> IO () -> IO (Maybe Bytes, Maybe Bytes)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Subprocess
-> Ptr Bytes
-> Ptr Cancellable
-> Ptr (Ptr Bytes)
-> Ptr (Ptr Bytes)
-> Ptr (Ptr GError)
-> IO CInt
g_subprocess_communicate Ptr Subprocess
subprocess' Ptr Bytes
maybeStdinBuf Ptr Cancellable
maybeCancellable Ptr (Ptr Bytes)
stdoutBuf Ptr (Ptr Bytes)
stderrBuf
        Ptr Bytes
stdoutBuf' <- Ptr (Ptr Bytes) -> IO (Ptr Bytes)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Bytes)
stdoutBuf
        Maybe Bytes
maybeStdoutBuf' <- Ptr Bytes -> (Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Bytes
stdoutBuf' ((Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes))
-> (Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes)
forall a b. (a -> b) -> a -> b
$ \Ptr Bytes
stdoutBuf'' -> do
            Bytes
stdoutBuf''' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
stdoutBuf''
            Bytes -> IO Bytes
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bytes
stdoutBuf'''
        Ptr Bytes
stderrBuf' <- Ptr (Ptr Bytes) -> IO (Ptr Bytes)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Bytes)
stderrBuf
        Maybe Bytes
maybeStderrBuf' <- Ptr Bytes -> (Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Bytes
stderrBuf' ((Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes))
-> (Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes)
forall a b. (a -> b) -> a -> b
$ \Ptr Bytes
stderrBuf'' -> do
            Bytes
stderrBuf''' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
stderrBuf''
            Bytes -> IO Bytes
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bytes
stderrBuf'''
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
        Maybe Bytes -> (Bytes -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Bytes
stdinBuf Bytes -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
stdoutBuf
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
stderrBuf
        (Maybe Bytes, Maybe Bytes) -> IO (Maybe Bytes, Maybe Bytes)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Bytes
maybeStdoutBuf', Maybe Bytes
maybeStderrBuf')
     ) (do
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
stdoutBuf
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
stderrBuf
     )

#if defined(ENABLE_OVERLOADING)
data SubprocessCommunicateMethodInfo
instance (signature ~ (Maybe (GLib.Bytes.Bytes) -> Maybe (b) -> m ((Maybe GLib.Bytes.Bytes, Maybe GLib.Bytes.Bytes))), MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SubprocessCommunicateMethodInfo a signature where
    overloadedMethod = subprocessCommunicate

instance O.OverloadedMethodInfo SubprocessCommunicateMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessCommunicate",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessCommunicate"
        })


#endif

-- method Subprocess::communicate_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Just "Self" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stdin_buf"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input data, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeAsync
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "User data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_communicate_async" g_subprocess_communicate_async :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr GLib.Bytes.Bytes ->                 -- stdin_buf : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Asynchronous version of 'GI.Gio.Objects.Subprocess.subprocessCommunicate'.  Complete
-- invocation with 'GI.Gio.Objects.Subprocess.subprocessCommunicateFinish'.
subprocessCommunicateAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@subprocess@/: Self
    -> Maybe (GLib.Bytes.Bytes)
    -- ^ /@stdinBuf@/: Input data, or 'P.Nothing'
    -> Maybe (b)
    -- ^ /@cancellable@/: Cancellable
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: Callback
    -> m ()
subprocessCommunicateAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) =>
a -> Maybe Bytes -> Maybe b -> Maybe AsyncReadyCallback -> m ()
subprocessCommunicateAsync a
subprocess Maybe Bytes
stdinBuf Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr Bytes
maybeStdinBuf <- case Maybe Bytes
stdinBuf of
        Maybe Bytes
Nothing -> Ptr Bytes -> IO (Ptr Bytes)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Bytes
forall a. Ptr a
nullPtr
        Just Bytes
jStdinBuf -> do
            Ptr Bytes
jStdinBuf' <- Bytes -> IO (Ptr Bytes)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Bytes
jStdinBuf
            Ptr Bytes -> IO (Ptr Bytes)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Bytes
jStdinBuf'
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr Subprocess
-> Ptr Bytes
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_subprocess_communicate_async Ptr Subprocess
subprocess' Ptr Bytes
maybeStdinBuf Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Maybe Bytes -> (Bytes -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Bytes
stdinBuf Bytes -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data SubprocessCommunicateAsyncMethodInfo
instance (signature ~ (Maybe (GLib.Bytes.Bytes) -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SubprocessCommunicateAsyncMethodInfo a signature where
    overloadedMethod = subprocessCommunicateAsync

instance O.OverloadedMethodInfo SubprocessCommunicateAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessCommunicateAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessCommunicateAsync"
        })


#endif

-- method Subprocess::communicate_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Just "Self" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Result" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stdout_buf"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for stdout data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "stderr_buf"
--           , argType = TInterface Name { namespace = "GLib" , name = "Bytes" }
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for stderr data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_subprocess_communicate_finish" g_subprocess_communicate_finish :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GLib.Bytes.Bytes) ->           -- stdout_buf : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr (Ptr GLib.Bytes.Bytes) ->           -- stderr_buf : TInterface (Name {namespace = "GLib", name = "Bytes"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Complete an invocation of 'GI.Gio.Objects.Subprocess.subprocessCommunicateAsync'.
subprocessCommunicateFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@subprocess@/: Self
    -> b
    -- ^ /@result@/: Result
    -> m ((Maybe GLib.Bytes.Bytes, Maybe GLib.Bytes.Bytes))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
subprocessCommunicateFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) =>
a -> b -> m (Maybe Bytes, Maybe Bytes)
subprocessCommunicateFinish a
subprocess b
result_ = IO (Maybe Bytes, Maybe Bytes) -> m (Maybe Bytes, Maybe Bytes)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Bytes, Maybe Bytes) -> m (Maybe Bytes, Maybe Bytes))
-> IO (Maybe Bytes, Maybe Bytes) -> m (Maybe Bytes, Maybe Bytes)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    Ptr (Ptr Bytes)
stdoutBuf <- IO (Ptr (Ptr Bytes))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr GLib.Bytes.Bytes))
    Ptr (Ptr Bytes)
stderrBuf <- IO (Ptr (Ptr Bytes))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr GLib.Bytes.Bytes))
    IO (Maybe Bytes, Maybe Bytes)
-> IO () -> IO (Maybe Bytes, Maybe Bytes)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Subprocess
-> Ptr AsyncResult
-> Ptr (Ptr Bytes)
-> Ptr (Ptr Bytes)
-> Ptr (Ptr GError)
-> IO CInt
g_subprocess_communicate_finish Ptr Subprocess
subprocess' Ptr AsyncResult
result_' Ptr (Ptr Bytes)
stdoutBuf Ptr (Ptr Bytes)
stderrBuf
        Ptr Bytes
stdoutBuf' <- Ptr (Ptr Bytes) -> IO (Ptr Bytes)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Bytes)
stdoutBuf
        Maybe Bytes
maybeStdoutBuf' <- Ptr Bytes -> (Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Bytes
stdoutBuf' ((Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes))
-> (Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes)
forall a b. (a -> b) -> a -> b
$ \Ptr Bytes
stdoutBuf'' -> do
            Bytes
stdoutBuf''' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
stdoutBuf''
            Bytes -> IO Bytes
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bytes
stdoutBuf'''
        Ptr Bytes
stderrBuf' <- Ptr (Ptr Bytes) -> IO (Ptr Bytes)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Bytes)
stderrBuf
        Maybe Bytes
maybeStderrBuf' <- Ptr Bytes -> (Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Bytes
stderrBuf' ((Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes))
-> (Ptr Bytes -> IO Bytes) -> IO (Maybe Bytes)
forall a b. (a -> b) -> a -> b
$ \Ptr Bytes
stderrBuf'' -> do
            Bytes
stderrBuf''' <- ((ManagedPtr Bytes -> Bytes) -> Ptr Bytes -> IO Bytes
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Bytes -> Bytes
GLib.Bytes.Bytes) Ptr Bytes
stderrBuf''
            Bytes -> IO Bytes
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bytes
stderrBuf'''
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
stdoutBuf
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
stderrBuf
        (Maybe Bytes, Maybe Bytes) -> IO (Maybe Bytes, Maybe Bytes)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Bytes
maybeStdoutBuf', Maybe Bytes
maybeStderrBuf')
     ) (do
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
stdoutBuf
        Ptr (Ptr Bytes) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Bytes)
stderrBuf
     )

#if defined(ENABLE_OVERLOADING)
data SubprocessCommunicateFinishMethodInfo
instance (signature ~ (b -> m ((Maybe GLib.Bytes.Bytes, Maybe GLib.Bytes.Bytes))), MonadIO m, IsSubprocess a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod SubprocessCommunicateFinishMethodInfo a signature where
    overloadedMethod = subprocessCommunicateFinish

instance O.OverloadedMethodInfo SubprocessCommunicateFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessCommunicateFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessCommunicateFinish"
        })


#endif

-- method Subprocess::communicate_utf8
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stdin_buf"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "data to send to the stdin of the subprocess, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stdout_buf"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data read from the subprocess stdout"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "stderr_buf"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data read from the subprocess stderr"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_subprocess_communicate_utf8" g_subprocess_communicate_utf8 :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    CString ->                              -- stdin_buf : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr CString ->                          -- stdout_buf : TBasicType TUTF8
    Ptr CString ->                          -- stderr_buf : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Like 'GI.Gio.Objects.Subprocess.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.
subprocessCommunicateUtf8 ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> Maybe (T.Text)
    -- ^ /@stdinBuf@/: data to send to the stdin of the subprocess, or 'P.Nothing'
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable'
    -> m ((Maybe T.Text, Maybe T.Text))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
subprocessCommunicateUtf8 :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) =>
a -> Maybe Text -> Maybe b -> m (Maybe Text, Maybe Text)
subprocessCommunicateUtf8 a
subprocess Maybe Text
stdinBuf Maybe b
cancellable = IO (Maybe Text, Maybe Text) -> m (Maybe Text, Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text, Maybe Text) -> m (Maybe Text, Maybe Text))
-> IO (Maybe Text, Maybe Text) -> m (Maybe Text, Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    CString
maybeStdinBuf <- case Maybe Text
stdinBuf of
        Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jStdinBuf -> do
            CString
jStdinBuf' <- Text -> IO CString
textToCString Text
jStdinBuf
            CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jStdinBuf'
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    Ptr CString
stdoutBuf <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CString
stderrBuf <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    IO (Maybe Text, Maybe Text) -> IO () -> IO (Maybe Text, Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Subprocess
-> CString
-> Ptr Cancellable
-> Ptr CString
-> Ptr CString
-> Ptr (Ptr GError)
-> IO CInt
g_subprocess_communicate_utf8 Ptr Subprocess
subprocess' CString
maybeStdinBuf Ptr Cancellable
maybeCancellable Ptr CString
stdoutBuf Ptr CString
stderrBuf
        CString
stdoutBuf' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
stdoutBuf
        Maybe Text
maybeStdoutBuf' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
stdoutBuf' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
stdoutBuf'' -> do
            Text
stdoutBuf''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
stdoutBuf''
            Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
stdoutBuf'''
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
stdoutBuf'
        CString
stderrBuf' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
stderrBuf
        Maybe Text
maybeStderrBuf' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
stderrBuf' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
stderrBuf'' -> do
            Text
stderrBuf''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
stderrBuf''
            Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
stderrBuf'''
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
stderrBuf'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeStdinBuf
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
stdoutBuf
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
stderrBuf
        (Maybe Text, Maybe Text) -> IO (Maybe Text, Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Text
maybeStdoutBuf', Maybe Text
maybeStderrBuf')
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeStdinBuf
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
stdoutBuf
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
stderrBuf
     )

#if defined(ENABLE_OVERLOADING)
data SubprocessCommunicateUtf8MethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (b) -> m ((Maybe T.Text, Maybe T.Text))), MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SubprocessCommunicateUtf8MethodInfo a signature where
    overloadedMethod = subprocessCommunicateUtf8

instance O.OverloadedMethodInfo SubprocessCommunicateUtf8MethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessCommunicateUtf8",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessCommunicateUtf8"
        })


#endif

-- method Subprocess::communicate_utf8_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Just "Self" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stdin_buf"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input data, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Callback" , sinceVersion = Nothing }
--           , argScope = ScopeTypeAsync
--           , argClosure = 4
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "User data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_communicate_utf8_async" g_subprocess_communicate_utf8_async :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    CString ->                              -- stdin_buf : TBasicType TUTF8
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Asynchronous version of 'GI.Gio.Objects.Subprocess.subprocessCommunicateUtf8'.  Complete
-- invocation with 'GI.Gio.Objects.Subprocess.subprocessCommunicateUtf8Finish'.
subprocessCommunicateUtf8Async ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@subprocess@/: Self
    -> Maybe (T.Text)
    -- ^ /@stdinBuf@/: Input data, or 'P.Nothing'
    -> Maybe (b)
    -- ^ /@cancellable@/: Cancellable
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: Callback
    -> m ()
subprocessCommunicateUtf8Async :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) =>
a -> Maybe Text -> Maybe b -> Maybe AsyncReadyCallback -> m ()
subprocessCommunicateUtf8Async a
subprocess Maybe Text
stdinBuf Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    CString
maybeStdinBuf <- case Maybe Text
stdinBuf of
        Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jStdinBuf -> do
            CString
jStdinBuf' <- Text -> IO CString
textToCString Text
jStdinBuf
            CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jStdinBuf'
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr Subprocess
-> CString
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_subprocess_communicate_utf8_async Ptr Subprocess
subprocess' CString
maybeStdinBuf Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeStdinBuf
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data SubprocessCommunicateUtf8AsyncMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SubprocessCommunicateUtf8AsyncMethodInfo a signature where
    overloadedMethod = subprocessCommunicateUtf8Async

instance O.OverloadedMethodInfo SubprocessCommunicateUtf8AsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessCommunicateUtf8Async",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessCommunicateUtf8Async"
        })


#endif

-- method Subprocess::communicate_utf8_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Just "Self" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Result" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stdout_buf"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for stdout data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "stderr_buf"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return location for stderr data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_subprocess_communicate_utf8_finish" g_subprocess_communicate_utf8_finish :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr CString ->                          -- stdout_buf : TBasicType TUTF8
    Ptr CString ->                          -- stderr_buf : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Complete an invocation of 'GI.Gio.Objects.Subprocess.subprocessCommunicateUtf8Async'.
subprocessCommunicateUtf8Finish ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@subprocess@/: Self
    -> b
    -- ^ /@result@/: Result
    -> m ((Maybe T.Text, Maybe T.Text))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
subprocessCommunicateUtf8Finish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) =>
a -> b -> m (Maybe Text, Maybe Text)
subprocessCommunicateUtf8Finish a
subprocess b
result_ = IO (Maybe Text, Maybe Text) -> m (Maybe Text, Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text, Maybe Text) -> m (Maybe Text, Maybe Text))
-> IO (Maybe Text, Maybe Text) -> m (Maybe Text, Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    Ptr CString
stdoutBuf <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CString
stderrBuf <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    IO (Maybe Text, Maybe Text) -> IO () -> IO (Maybe Text, Maybe Text)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Subprocess
-> Ptr AsyncResult
-> Ptr CString
-> Ptr CString
-> Ptr (Ptr GError)
-> IO CInt
g_subprocess_communicate_utf8_finish Ptr Subprocess
subprocess' Ptr AsyncResult
result_' Ptr CString
stdoutBuf Ptr CString
stderrBuf
        CString
stdoutBuf' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
stdoutBuf
        Maybe Text
maybeStdoutBuf' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
stdoutBuf' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
stdoutBuf'' -> do
            Text
stdoutBuf''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
stdoutBuf''
            Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
stdoutBuf'''
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
stdoutBuf'
        CString
stderrBuf' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
stderrBuf
        Maybe Text
maybeStderrBuf' <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
stderrBuf' ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
stderrBuf'' -> do
            Text
stderrBuf''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
stderrBuf''
            Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
stderrBuf'''
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
stderrBuf'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
stdoutBuf
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
stderrBuf
        (Maybe Text, Maybe Text) -> IO (Maybe Text, Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe Text
maybeStdoutBuf', Maybe Text
maybeStderrBuf')
     ) (do
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
stdoutBuf
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
stderrBuf
     )

#if defined(ENABLE_OVERLOADING)
data SubprocessCommunicateUtf8FinishMethodInfo
instance (signature ~ (b -> m ((Maybe T.Text, Maybe T.Text))), MonadIO m, IsSubprocess a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod SubprocessCommunicateUtf8FinishMethodInfo a signature where
    overloadedMethod = subprocessCommunicateUtf8Finish

instance O.OverloadedMethodInfo SubprocessCommunicateUtf8FinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessCommunicateUtf8Finish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessCommunicateUtf8Finish"
        })


#endif

-- method Subprocess::force_exit
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_force_exit" g_subprocess_force_exit :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO ()

-- | 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 'GI.Gio.Objects.Subprocess.subprocessWait' to monitor the status of
-- the process after calling this function.
-- 
-- On Unix, this function sends @/SIGKILL/@.
-- 
-- /Since: 2.40/
subprocessForceExit ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m ()
subprocessForceExit :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m ()
subprocessForceExit a
subprocess = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr Subprocess -> IO ()
g_subprocess_force_exit Ptr Subprocess
subprocess'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data SubprocessForceExitMethodInfo
instance (signature ~ (m ()), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessForceExitMethodInfo a signature where
    overloadedMethod = subprocessForceExit

instance O.OverloadedMethodInfo SubprocessForceExitMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessForceExit",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessForceExit"
        })


#endif

-- method Subprocess::get_exit_status
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_exit_status" g_subprocess_get_exit_status :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO Int32

-- | 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 'GI.Gio.Objects.Subprocess.subprocessWait' and
-- unless 'GI.Gio.Objects.Subprocess.subprocessGetIfExited' returned 'P.True'.
-- 
-- /Since: 2.40/
subprocessGetExitStatus ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m Int32
    -- ^ __Returns:__ the exit status
subprocessGetExitStatus :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m Int32
subprocessGetExitStatus a
subprocess = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Int32
result <- Ptr Subprocess -> IO Int32
g_subprocess_get_exit_status Ptr Subprocess
subprocess'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

#if defined(ENABLE_OVERLOADING)
data SubprocessGetExitStatusMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetExitStatusMethodInfo a signature where
    overloadedMethod = subprocessGetExitStatus

instance O.OverloadedMethodInfo SubprocessGetExitStatusMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetExitStatus",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetExitStatus"
        })


#endif

-- method Subprocess::get_identifier
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_identifier" g_subprocess_get_identifier :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO CString

-- | 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 'P.Nothing'.
-- 
-- /Since: 2.40/
subprocessGetIdentifier ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m (Maybe T.Text)
    -- ^ __Returns:__ the subprocess identifier, or 'P.Nothing' if the subprocess
    --    has terminated
subprocessGetIdentifier :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m (Maybe Text)
subprocessGetIdentifier a
subprocess = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    CString
result <- Ptr Subprocess -> IO CString
g_subprocess_get_identifier Ptr Subprocess
subprocess'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult

#if defined(ENABLE_OVERLOADING)
data SubprocessGetIdentifierMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetIdentifierMethodInfo a signature where
    overloadedMethod = subprocessGetIdentifier

instance O.OverloadedMethodInfo SubprocessGetIdentifierMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetIdentifier",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetIdentifier"
        })


#endif

-- method Subprocess::get_if_exited
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_if_exited" g_subprocess_get_if_exited :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO CInt

-- | 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 'GI.Gio.Objects.Subprocess.subprocessWait' has
-- returned.
-- 
-- /Since: 2.40/
subprocessGetIfExited ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the case of a normal exit
subprocessGetIfExited :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m Bool
subprocessGetIfExited a
subprocess = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    CInt
result <- Ptr Subprocess -> IO CInt
g_subprocess_get_if_exited Ptr Subprocess
subprocess'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data SubprocessGetIfExitedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetIfExitedMethodInfo a signature where
    overloadedMethod = subprocessGetIfExited

instance O.OverloadedMethodInfo SubprocessGetIfExitedMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetIfExited",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetIfExited"
        })


#endif

-- method Subprocess::get_if_signaled
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_if_signaled" g_subprocess_get_if_signaled :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO CInt

-- | 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 'GI.Gio.Objects.Subprocess.subprocessWait' has
-- returned.
-- 
-- /Since: 2.40/
subprocessGetIfSignaled ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the case of termination due to a signal
subprocessGetIfSignaled :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m Bool
subprocessGetIfSignaled a
subprocess = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    CInt
result <- Ptr Subprocess -> IO CInt
g_subprocess_get_if_signaled Ptr Subprocess
subprocess'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data SubprocessGetIfSignaledMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetIfSignaledMethodInfo a signature where
    overloadedMethod = subprocessGetIfSignaled

instance O.OverloadedMethodInfo SubprocessGetIfSignaledMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetIfSignaled",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetIfSignaled"
        })


#endif

-- method Subprocess::get_status
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_status" g_subprocess_get_status :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO Int32

-- | 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 'GI.GLib.Functions.spawnCheckWaitStatus'.
-- 
-- It is more likely that you want to use 'GI.Gio.Objects.Subprocess.subprocessGetIfExited'
-- followed by 'GI.Gio.Objects.Subprocess.subprocessGetExitStatus'.
-- 
-- It is an error to call this function before 'GI.Gio.Objects.Subprocess.subprocessWait' has
-- returned.
-- 
-- /Since: 2.40/
subprocessGetStatus ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m Int32
    -- ^ __Returns:__ the (meaningless) @/waitpid()/@ exit status from the kernel
subprocessGetStatus :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m Int32
subprocessGetStatus a
subprocess = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Int32
result <- Ptr Subprocess -> IO Int32
g_subprocess_get_status Ptr Subprocess
subprocess'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

#if defined(ENABLE_OVERLOADING)
data SubprocessGetStatusMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetStatusMethodInfo a signature where
    overloadedMethod = subprocessGetStatus

instance O.OverloadedMethodInfo SubprocessGetStatusMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetStatus",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetStatus"
        })


#endif

-- method Subprocess::get_stderr_pipe
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "InputStream" })
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_stderr_pipe" g_subprocess_get_stderr_pipe :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO (Ptr Gio.InputStream.InputStream)

-- | Gets the t'GI.Gio.Objects.InputStream.InputStream' from which to read the stderr output of
-- /@subprocess@/.
-- 
-- The process must have been created with 'GI.Gio.Flags.SubprocessFlagsStderrPipe',
-- otherwise 'P.Nothing' will be returned.
-- 
-- /Since: 2.40/
subprocessGetStderrPipe ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m (Maybe Gio.InputStream.InputStream)
    -- ^ __Returns:__ the stderr pipe
subprocessGetStderrPipe :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m (Maybe InputStream)
subprocessGetStderrPipe a
subprocess = IO (Maybe InputStream) -> m (Maybe InputStream)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe InputStream) -> m (Maybe InputStream))
-> IO (Maybe InputStream) -> m (Maybe InputStream)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr InputStream
result <- Ptr Subprocess -> IO (Ptr InputStream)
g_subprocess_get_stderr_pipe Ptr Subprocess
subprocess'
    Maybe InputStream
maybeResult <- Ptr InputStream
-> (Ptr InputStream -> IO InputStream) -> IO (Maybe InputStream)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr InputStream
result ((Ptr InputStream -> IO InputStream) -> IO (Maybe InputStream))
-> (Ptr InputStream -> IO InputStream) -> IO (Maybe InputStream)
forall a b. (a -> b) -> a -> b
$ \Ptr InputStream
result' -> do
        InputStream
result'' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
result'
        InputStream -> IO InputStream
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return InputStream
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Maybe InputStream -> IO (Maybe InputStream)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe InputStream
maybeResult

#if defined(ENABLE_OVERLOADING)
data SubprocessGetStderrPipeMethodInfo
instance (signature ~ (m (Maybe Gio.InputStream.InputStream)), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetStderrPipeMethodInfo a signature where
    overloadedMethod = subprocessGetStderrPipe

instance O.OverloadedMethodInfo SubprocessGetStderrPipeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetStderrPipe",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetStderrPipe"
        })


#endif

-- method Subprocess::get_stdin_pipe
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "OutputStream" })
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_stdin_pipe" g_subprocess_get_stdin_pipe :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO (Ptr Gio.OutputStream.OutputStream)

-- | Gets the t'GI.Gio.Objects.OutputStream.OutputStream' that you can write to in order to give data
-- to the stdin of /@subprocess@/.
-- 
-- The process must have been created with 'GI.Gio.Flags.SubprocessFlagsStdinPipe' and
-- not 'GI.Gio.Flags.SubprocessFlagsStdinInherit', otherwise 'P.Nothing' will be returned.
-- 
-- /Since: 2.40/
subprocessGetStdinPipe ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m (Maybe Gio.OutputStream.OutputStream)
    -- ^ __Returns:__ the stdout pipe
subprocessGetStdinPipe :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m (Maybe OutputStream)
subprocessGetStdinPipe a
subprocess = IO (Maybe OutputStream) -> m (Maybe OutputStream)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe OutputStream) -> m (Maybe OutputStream))
-> IO (Maybe OutputStream) -> m (Maybe OutputStream)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr OutputStream
result <- Ptr Subprocess -> IO (Ptr OutputStream)
g_subprocess_get_stdin_pipe Ptr Subprocess
subprocess'
    Maybe OutputStream
maybeResult <- Ptr OutputStream
-> (Ptr OutputStream -> IO OutputStream) -> IO (Maybe OutputStream)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr OutputStream
result ((Ptr OutputStream -> IO OutputStream) -> IO (Maybe OutputStream))
-> (Ptr OutputStream -> IO OutputStream) -> IO (Maybe OutputStream)
forall a b. (a -> b) -> a -> b
$ \Ptr OutputStream
result' -> do
        OutputStream
result'' <- ((ManagedPtr OutputStream -> OutputStream)
-> Ptr OutputStream -> IO OutputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr OutputStream -> OutputStream
Gio.OutputStream.OutputStream) Ptr OutputStream
result'
        OutputStream -> IO OutputStream
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return OutputStream
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Maybe OutputStream -> IO (Maybe OutputStream)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe OutputStream
maybeResult

#if defined(ENABLE_OVERLOADING)
data SubprocessGetStdinPipeMethodInfo
instance (signature ~ (m (Maybe Gio.OutputStream.OutputStream)), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetStdinPipeMethodInfo a signature where
    overloadedMethod = subprocessGetStdinPipe

instance O.OverloadedMethodInfo SubprocessGetStdinPipeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetStdinPipe",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetStdinPipe"
        })


#endif

-- method Subprocess::get_stdout_pipe
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "InputStream" })
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_stdout_pipe" g_subprocess_get_stdout_pipe :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO (Ptr Gio.InputStream.InputStream)

-- | Gets the t'GI.Gio.Objects.InputStream.InputStream' from which to read the stdout output of
-- /@subprocess@/.
-- 
-- The process must have been created with 'GI.Gio.Flags.SubprocessFlagsStdoutPipe',
-- otherwise 'P.Nothing' will be returned.
-- 
-- /Since: 2.40/
subprocessGetStdoutPipe ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m (Maybe Gio.InputStream.InputStream)
    -- ^ __Returns:__ the stdout pipe
subprocessGetStdoutPipe :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m (Maybe InputStream)
subprocessGetStdoutPipe a
subprocess = IO (Maybe InputStream) -> m (Maybe InputStream)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe InputStream) -> m (Maybe InputStream))
-> IO (Maybe InputStream) -> m (Maybe InputStream)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr InputStream
result <- Ptr Subprocess -> IO (Ptr InputStream)
g_subprocess_get_stdout_pipe Ptr Subprocess
subprocess'
    Maybe InputStream
maybeResult <- Ptr InputStream
-> (Ptr InputStream -> IO InputStream) -> IO (Maybe InputStream)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr InputStream
result ((Ptr InputStream -> IO InputStream) -> IO (Maybe InputStream))
-> (Ptr InputStream -> IO InputStream) -> IO (Maybe InputStream)
forall a b. (a -> b) -> a -> b
$ \Ptr InputStream
result' -> do
        InputStream
result'' <- ((ManagedPtr InputStream -> InputStream)
-> Ptr InputStream -> IO InputStream
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr InputStream -> InputStream
Gio.InputStream.InputStream) Ptr InputStream
result'
        InputStream -> IO InputStream
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return InputStream
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Maybe InputStream -> IO (Maybe InputStream)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe InputStream
maybeResult

#if defined(ENABLE_OVERLOADING)
data SubprocessGetStdoutPipeMethodInfo
instance (signature ~ (m (Maybe Gio.InputStream.InputStream)), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetStdoutPipeMethodInfo a signature where
    overloadedMethod = subprocessGetStdoutPipe

instance O.OverloadedMethodInfo SubprocessGetStdoutPipeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetStdoutPipe",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetStdoutPipe"
        })


#endif

-- method Subprocess::get_successful
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_successful" g_subprocess_get_successful :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO CInt

-- | 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 'GI.Gio.Objects.Subprocess.subprocessWait' has
-- returned.
-- 
-- /Since: 2.40/
subprocessGetSuccessful ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the process exited cleanly with a exit status of 0
subprocessGetSuccessful :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m Bool
subprocessGetSuccessful a
subprocess = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    CInt
result <- Ptr Subprocess -> IO CInt
g_subprocess_get_successful Ptr Subprocess
subprocess'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data SubprocessGetSuccessfulMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetSuccessfulMethodInfo a signature where
    overloadedMethod = subprocessGetSuccessful

instance O.OverloadedMethodInfo SubprocessGetSuccessfulMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetSuccessful",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetSuccessful"
        })


#endif

-- method Subprocess::get_term_sig
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_get_term_sig" g_subprocess_get_term_sig :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    IO Int32

-- | 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 'GI.Gio.Objects.Subprocess.subprocessWait' and
-- unless 'GI.Gio.Objects.Subprocess.subprocessGetIfSignaled' returned 'P.True'.
-- 
-- /Since: 2.40/
subprocessGetTermSig ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> m Int32
    -- ^ __Returns:__ the signal causing termination
subprocessGetTermSig :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> m Int32
subprocessGetTermSig a
subprocess = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Int32
result <- Ptr Subprocess -> IO Int32
g_subprocess_get_term_sig Ptr Subprocess
subprocess'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

#if defined(ENABLE_OVERLOADING)
data SubprocessGetTermSigMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessGetTermSigMethodInfo a signature where
    overloadedMethod = subprocessGetTermSig

instance O.OverloadedMethodInfo SubprocessGetTermSigMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessGetTermSig",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessGetTermSig"
        })


#endif

-- method Subprocess::send_signal
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "signal_num"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the signal number to send"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_send_signal" g_subprocess_send_signal :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Int32 ->                                -- signal_num : TBasicType TInt
    IO ()

-- | 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/
subprocessSendSignal ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> Int32
    -- ^ /@signalNum@/: the signal number to send
    -> m ()
subprocessSendSignal :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSubprocess a) =>
a -> Int32 -> m ()
subprocessSendSignal a
subprocess Int32
signalNum = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr Subprocess -> Int32 -> IO ()
g_subprocess_send_signal Ptr Subprocess
subprocess' Int32
signalNum
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data SubprocessSendSignalMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsSubprocess a) => O.OverloadedMethod SubprocessSendSignalMethodInfo a signature where
    overloadedMethod = subprocessSendSignal

instance O.OverloadedMethodInfo SubprocessSendSignalMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessSendSignal",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessSendSignal"
        })


#endif

-- method Subprocess::wait
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_subprocess_wait" g_subprocess_wait :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Synchronously wait for the subprocess to terminate.
-- 
-- After the process terminates you can query its exit status with
-- functions such as 'GI.Gio.Objects.Subprocess.subprocessGetIfExited' and
-- 'GI.Gio.Objects.Subprocess.subprocessGetExitStatus'.
-- 
-- This function does not fail in the case of the subprocess having
-- abnormal termination.  See 'GI.Gio.Objects.Subprocess.subprocessWaitCheck' for that.
-- 
-- Cancelling /@cancellable@/ doesn\'t kill the subprocess.  Call
-- 'GI.Gio.Objects.Subprocess.subprocessForceExit' if it is desirable.
-- 
-- /Since: 2.40/
subprocessWait ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
subprocessWait :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) =>
a -> Maybe b -> m ()
subprocessWait a
subprocess Maybe b
cancellable = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Subprocess -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_subprocess_wait Ptr Subprocess
subprocess' Ptr Cancellable
maybeCancellable
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SubprocessWaitMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SubprocessWaitMethodInfo a signature where
    overloadedMethod = subprocessWait

instance O.OverloadedMethodInfo SubprocessWaitMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessWait",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessWait"
        })


#endif

-- method Subprocess::wait_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GAsyncReadyCallback to call when the operation is complete"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user_data for @callback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_wait_async" g_subprocess_wait_async :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Wait for the subprocess to terminate.
-- 
-- This is the asynchronous version of 'GI.Gio.Objects.Subprocess.subprocessWait'.
-- 
-- /Since: 2.40/
subprocessWaitAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: a t'GI.Gio.Callbacks.AsyncReadyCallback' to call when the operation is complete
    -> m ()
subprocessWaitAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) =>
a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
subprocessWaitAsync a
subprocess Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr Subprocess
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_subprocess_wait_async Ptr Subprocess
subprocess' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data SubprocessWaitAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SubprocessWaitAsyncMethodInfo a signature where
    overloadedMethod = subprocessWaitAsync

instance O.OverloadedMethodInfo SubprocessWaitAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessWaitAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessWaitAsync"
        })


#endif

-- method Subprocess::wait_check
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_subprocess_wait_check" g_subprocess_wait_check :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Combines 'GI.Gio.Objects.Subprocess.subprocessWait' with 'GI.GLib.Functions.spawnCheckWaitStatus'.
-- 
-- /Since: 2.40/
subprocessWaitCheck ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
subprocessWaitCheck :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) =>
a -> Maybe b -> m ()
subprocessWaitCheck a
subprocess Maybe b
cancellable = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Subprocess -> Ptr Cancellable -> Ptr (Ptr GError) -> IO CInt
g_subprocess_wait_check Ptr Subprocess
subprocess' Ptr Cancellable
maybeCancellable
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
        Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SubprocessWaitCheckMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SubprocessWaitCheckMethodInfo a signature where
    overloadedMethod = subprocessWaitCheck

instance O.OverloadedMethodInfo SubprocessWaitCheckMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessWaitCheck",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessWaitCheck"
        })


#endif

-- method Subprocess::wait_check_async
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cancellable"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Cancellable" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GCancellable, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "callback"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncReadyCallback" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #GAsyncReadyCallback to call when the operation is complete"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user_data for @callback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_subprocess_wait_check_async" g_subprocess_wait_check_async :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr Gio.Cancellable.Cancellable ->      -- cancellable : TInterface (Name {namespace = "Gio", name = "Cancellable"})
    FunPtr Gio.Callbacks.C_AsyncReadyCallback -> -- callback : TInterface (Name {namespace = "Gio", name = "AsyncReadyCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO ()

-- | Combines 'GI.Gio.Objects.Subprocess.subprocessWaitAsync' with 'GI.GLib.Functions.spawnCheckWaitStatus'.
-- 
-- This is the asynchronous version of 'GI.Gio.Objects.Subprocess.subprocessWaitCheck'.
-- 
-- /Since: 2.40/
subprocessWaitCheckAsync ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> Maybe (b)
    -- ^ /@cancellable@/: a t'GI.Gio.Objects.Cancellable.Cancellable', or 'P.Nothing'
    -> Maybe (Gio.Callbacks.AsyncReadyCallback)
    -- ^ /@callback@/: a t'GI.Gio.Callbacks.AsyncReadyCallback' to call when the operation is complete
    -> m ()
subprocessWaitCheckAsync :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsCancellable b) =>
a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
subprocessWaitCheckAsync a
subprocess Maybe b
cancellable Maybe AsyncReadyCallback
callback = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr Cancellable
maybeCancellable <- case Maybe b
cancellable of
        Maybe b
Nothing -> Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
forall a. Ptr a
nullPtr
        Just b
jCancellable -> do
            Ptr Cancellable
jCancellable' <- b -> IO (Ptr Cancellable)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jCancellable
            Ptr Cancellable -> IO (Ptr Cancellable)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Cancellable
jCancellable'
    FunPtr C_AsyncReadyCallback
maybeCallback <- case Maybe AsyncReadyCallback
callback of
        Maybe AsyncReadyCallback
Nothing -> FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_AsyncReadyCallback
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
        Just AsyncReadyCallback
jCallback -> do
            Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback <- IO (Ptr (FunPtr C_AsyncReadyCallback))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Gio.Callbacks.C_AsyncReadyCallback))
            FunPtr C_AsyncReadyCallback
jCallback' <- C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
Gio.Callbacks.mk_AsyncReadyCallback (Maybe (Ptr (FunPtr C_AsyncReadyCallback))
-> AsyncReadyCallback_WithClosures -> C_AsyncReadyCallback
Gio.Callbacks.wrap_AsyncReadyCallback (Ptr (FunPtr C_AsyncReadyCallback)
-> Maybe (Ptr (FunPtr C_AsyncReadyCallback))
forall a. a -> Maybe a
Just Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback) (AsyncReadyCallback -> AsyncReadyCallback_WithClosures
Gio.Callbacks.drop_closures_AsyncReadyCallback AsyncReadyCallback
jCallback))
            Ptr (FunPtr C_AsyncReadyCallback)
-> FunPtr C_AsyncReadyCallback -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_AsyncReadyCallback)
ptrcallback FunPtr C_AsyncReadyCallback
jCallback'
            FunPtr C_AsyncReadyCallback -> IO (FunPtr C_AsyncReadyCallback)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_AsyncReadyCallback
jCallback'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    Ptr Subprocess
-> Ptr Cancellable
-> FunPtr C_AsyncReadyCallback
-> Ptr ()
-> IO ()
g_subprocess_wait_check_async Ptr Subprocess
subprocess' Ptr Cancellable
maybeCancellable FunPtr C_AsyncReadyCallback
maybeCallback Ptr ()
forall a. Ptr a
userData
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
cancellable b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data SubprocessWaitCheckAsyncMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (Gio.Callbacks.AsyncReadyCallback) -> m ()), MonadIO m, IsSubprocess a, Gio.Cancellable.IsCancellable b) => O.OverloadedMethod SubprocessWaitCheckAsyncMethodInfo a signature where
    overloadedMethod = subprocessWaitCheckAsync

instance O.OverloadedMethodInfo SubprocessWaitCheckAsyncMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessWaitCheckAsync",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessWaitCheckAsync"
        })


#endif

-- method Subprocess::wait_check_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #GAsyncResult passed to your #GAsyncReadyCallback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_subprocess_wait_check_finish" g_subprocess_wait_check_finish :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Collects the result of a previous call to
-- 'GI.Gio.Objects.Subprocess.subprocessWaitCheckAsync'.
-- 
-- /Since: 2.40/
subprocessWaitCheckFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> b
    -- ^ /@result@/: the t'GI.Gio.Interfaces.AsyncResult.AsyncResult' passed to your t'GI.Gio.Callbacks.AsyncReadyCallback'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
subprocessWaitCheckFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) =>
a -> b -> m ()
subprocessWaitCheckFinish a
subprocess b
result_ = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Subprocess -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_subprocess_wait_check_finish Ptr Subprocess
subprocess' Ptr AsyncResult
result_'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SubprocessWaitCheckFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsSubprocess a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod SubprocessWaitCheckFinishMethodInfo a signature where
    overloadedMethod = subprocessWaitCheckFinish

instance O.OverloadedMethodInfo SubprocessWaitCheckFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessWaitCheckFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessWaitCheckFinish"
        })


#endif

-- method Subprocess::wait_finish
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "subprocess"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "Subprocess" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GSubprocess" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "result"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "AsyncResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #GAsyncResult passed to your #GAsyncReadyCallback"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "g_subprocess_wait_finish" g_subprocess_wait_finish :: 
    Ptr Subprocess ->                       -- subprocess : TInterface (Name {namespace = "Gio", name = "Subprocess"})
    Ptr Gio.AsyncResult.AsyncResult ->      -- result : TInterface (Name {namespace = "Gio", name = "AsyncResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | Collects the result of a previous call to
-- 'GI.Gio.Objects.Subprocess.subprocessWaitAsync'.
-- 
-- /Since: 2.40/
subprocessWaitFinish ::
    (B.CallStack.HasCallStack, MonadIO m, IsSubprocess a, Gio.AsyncResult.IsAsyncResult b) =>
    a
    -- ^ /@subprocess@/: a t'GI.Gio.Objects.Subprocess.Subprocess'
    -> b
    -- ^ /@result@/: the t'GI.Gio.Interfaces.AsyncResult.AsyncResult' passed to your t'GI.Gio.Callbacks.AsyncReadyCallback'
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
subprocessWaitFinish :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsSubprocess a, IsAsyncResult b) =>
a -> b -> m ()
subprocessWaitFinish a
subprocess b
result_ = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Subprocess
subprocess' <- a -> IO (Ptr Subprocess)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
subprocess
    Ptr AsyncResult
result_' <- b -> IO (Ptr AsyncResult)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
result_
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr Subprocess -> Ptr AsyncResult -> Ptr (Ptr GError) -> IO CInt
g_subprocess_wait_finish Ptr Subprocess
subprocess' Ptr AsyncResult
result_'
        a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
subprocess
        b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
result_
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )

#if defined(ENABLE_OVERLOADING)
data SubprocessWaitFinishMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsSubprocess a, Gio.AsyncResult.IsAsyncResult b) => O.OverloadedMethod SubprocessWaitFinishMethodInfo a signature where
    overloadedMethod = subprocessWaitFinish

instance O.OverloadedMethodInfo SubprocessWaitFinishMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gio.Objects.Subprocess.subprocessWaitFinish",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.30/docs/GI-Gio-Objects-Subprocess.html#v:subprocessWaitFinish"
        })


#endif