{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Gio.Objects.Subprocess ( -- * Exported types Subprocess(..) , SubprocessK , toSubprocess , noSubprocess , -- * Methods -- ** subprocessCommunicate subprocessCommunicate , -- ** subprocessCommunicateAsync subprocessCommunicateAsync , -- ** subprocessCommunicateFinish subprocessCommunicateFinish , -- ** subprocessCommunicateUtf8 subprocessCommunicateUtf8 , -- ** subprocessCommunicateUtf8Async subprocessCommunicateUtf8Async , -- ** subprocessCommunicateUtf8Finish subprocessCommunicateUtf8Finish , -- ** subprocessForceExit subprocessForceExit , -- ** subprocessGetExitStatus subprocessGetExitStatus , -- ** subprocessGetIdentifier subprocessGetIdentifier , -- ** subprocessGetIfExited subprocessGetIfExited , -- ** subprocessGetIfSignaled subprocessGetIfSignaled , -- ** subprocessGetStatus subprocessGetStatus , -- ** subprocessGetStderrPipe subprocessGetStderrPipe , -- ** subprocessGetStdinPipe subprocessGetStdinPipe , -- ** subprocessGetStdoutPipe subprocessGetStdoutPipe , -- ** subprocessGetSuccessful subprocessGetSuccessful , -- ** subprocessGetTermSig subprocessGetTermSig , -- ** subprocessNew subprocessNew , -- ** subprocessSendSignal subprocessSendSignal , -- ** subprocessWait subprocessWait , -- ** subprocessWaitAsync subprocessWaitAsync , -- ** subprocessWaitCheck subprocessWaitCheck , -- ** subprocessWaitCheckAsync subprocessWaitCheckAsync , -- ** subprocessWaitCheckFinish subprocessWaitCheckFinish , -- ** subprocessWaitFinish subprocessWaitFinish , -- * Properties -- ** Argv SubprocessArgvPropertyInfo , constructSubprocessArgv , -- ** Flags SubprocessFlagsPropertyInfo , constructSubprocessFlags , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Gio.Types import GI.Gio.Callbacks import qualified GI.GLib as GLib import qualified GI.GObject as GObject newtype Subprocess = Subprocess (ForeignPtr Subprocess) foreign import ccall "g_subprocess_get_type" c_g_subprocess_get_type :: IO GType type instance ParentTypes Subprocess = SubprocessParentTypes type SubprocessParentTypes = '[GObject.Object, Initable] instance GObject Subprocess where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_g_subprocess_get_type class GObject o => SubprocessK o instance (GObject o, IsDescendantOf Subprocess o) => SubprocessK o toSubprocess :: SubprocessK o => o -> IO Subprocess toSubprocess = unsafeCastTo Subprocess noSubprocess :: Maybe Subprocess noSubprocess = Nothing -- VVV Prop "argv" -- Type: TCArray True (-1) (-1) (TBasicType TUTF8) -- Flags: [PropertyWritable,PropertyConstructOnly] constructSubprocessArgv :: [T.Text] -> IO ([Char], GValue) constructSubprocessArgv val = constructObjectPropertyStringArray "argv" val data SubprocessArgvPropertyInfo instance AttrInfo SubprocessArgvPropertyInfo where type AttrAllowedOps SubprocessArgvPropertyInfo = '[ 'AttrConstruct] type AttrSetTypeConstraint SubprocessArgvPropertyInfo = (~) [T.Text] type AttrBaseTypeConstraint SubprocessArgvPropertyInfo = SubprocessK type AttrGetType SubprocessArgvPropertyInfo = () type AttrLabel SubprocessArgvPropertyInfo = "Subprocess::argv" attrGet _ = undefined attrSet _ = undefined attrConstruct _ = constructSubprocessArgv -- VVV Prop "flags" -- Type: TInterface "Gio" "SubprocessFlags" -- Flags: [PropertyWritable,PropertyConstructOnly] constructSubprocessFlags :: [SubprocessFlags] -> IO ([Char], GValue) constructSubprocessFlags val = constructObjectPropertyFlags "flags" val data SubprocessFlagsPropertyInfo instance AttrInfo SubprocessFlagsPropertyInfo where type AttrAllowedOps SubprocessFlagsPropertyInfo = '[ 'AttrConstruct] type AttrSetTypeConstraint SubprocessFlagsPropertyInfo = (~) [SubprocessFlags] type AttrBaseTypeConstraint SubprocessFlagsPropertyInfo = SubprocessK type AttrGetType SubprocessFlagsPropertyInfo = () type AttrLabel SubprocessFlagsPropertyInfo = "Subprocess::flags" attrGet _ = undefined attrSet _ = undefined attrConstruct _ = constructSubprocessFlags type instance AttributeList Subprocess = SubprocessAttributeList type SubprocessAttributeList = ('[ '("argv", SubprocessArgvPropertyInfo), '("flags", SubprocessFlagsPropertyInfo)] :: [(Symbol, *)]) type instance SignalList Subprocess = SubprocessSignalList type SubprocessSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method Subprocess::new -- method type : Constructor -- Args : [Arg {argName = "argv", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "SubprocessFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "argv", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Gio" "SubprocessFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "Subprocess" -- throws : True -- Skip return : False foreign import ccall "g_subprocess_newv" g_subprocess_newv :: Ptr CString -> -- argv : TCArray True (-1) (-1) (TBasicType TUTF8) CUInt -> -- flags : TInterface "Gio" "SubprocessFlags" Ptr (Ptr GError) -> -- error IO (Ptr Subprocess) subprocessNew :: (MonadIO m) => [T.Text] -> -- argv [SubprocessFlags] -> -- flags m Subprocess subprocessNew argv flags = liftIO $ do argv' <- packZeroTerminatedUTF8CArray argv let flags' = gflagsToWord flags onException (do result <- propagateGError $ g_subprocess_newv argv' flags' checkUnexpectedReturnNULL "g_subprocess_newv" result result' <- (wrapObject Subprocess) result mapZeroTerminatedCArray freeMem argv' freeMem argv' return result' ) (do mapZeroTerminatedCArray freeMem argv' freeMem argv' ) -- method Subprocess::communicate -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdin_buf", argType = TInterface "GLib" "Bytes", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdout_buf", argType = TInterface "GLib" "Bytes", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "stderr_buf", argType = TInterface "GLib" "Bytes", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdin_buf", argType = TInterface "GLib" "Bytes", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_subprocess_communicate" g_subprocess_communicate :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr GLib.Bytes -> -- stdin_buf : TInterface "GLib" "Bytes" Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" Ptr (Ptr GLib.Bytes) -> -- stdout_buf : TInterface "GLib" "Bytes" Ptr (Ptr GLib.Bytes) -> -- stderr_buf : TInterface "GLib" "Bytes" Ptr (Ptr GError) -> -- error IO CInt subprocessCommunicate :: (MonadIO m, SubprocessK a, CancellableK b) => a -> -- _obj Maybe (GLib.Bytes) -> -- stdin_buf Maybe (b) -> -- cancellable m (GLib.Bytes,GLib.Bytes) subprocessCommunicate _obj stdin_buf cancellable = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeStdin_buf <- case stdin_buf of Nothing -> return nullPtr Just jStdin_buf -> do let jStdin_buf' = unsafeManagedPtrGetPtr jStdin_buf return jStdin_buf' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' stdout_buf <- allocMem :: IO (Ptr (Ptr GLib.Bytes)) stderr_buf <- allocMem :: IO (Ptr (Ptr GLib.Bytes)) onException (do _ <- propagateGError $ g_subprocess_communicate _obj' maybeStdin_buf maybeCancellable stdout_buf stderr_buf stdout_buf' <- peek stdout_buf stdout_buf'' <- (wrapBoxed GLib.Bytes) stdout_buf' stderr_buf' <- peek stderr_buf stderr_buf'' <- (wrapBoxed GLib.Bytes) stderr_buf' touchManagedPtr _obj whenJust stdin_buf touchManagedPtr whenJust cancellable touchManagedPtr freeMem stdout_buf freeMem stderr_buf return (stdout_buf'', stderr_buf'') ) (do freeMem stdout_buf freeMem stderr_buf ) -- method Subprocess::communicate_async -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdin_buf", argType = TInterface "GLib" "Bytes", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdin_buf", argType = TInterface "GLib" "Bytes", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_subprocess_communicate_async" g_subprocess_communicate_async :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr GLib.Bytes -> -- stdin_buf : TInterface "GLib" "Bytes" Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback" Ptr () -> -- user_data : TBasicType TVoid IO () subprocessCommunicateAsync :: (MonadIO m, SubprocessK a, CancellableK b) => a -> -- _obj Maybe (GLib.Bytes) -> -- stdin_buf Maybe (b) -> -- cancellable Maybe (AsyncReadyCallback) -> -- callback m () subprocessCommunicateAsync _obj stdin_buf cancellable callback = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeStdin_buf <- case stdin_buf of Nothing -> return nullPtr Just jStdin_buf -> do let jStdin_buf' = unsafeManagedPtrGetPtr jStdin_buf return jStdin_buf' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback) poke ptrcallback jCallback' return jCallback' let user_data = nullPtr g_subprocess_communicate_async _obj' maybeStdin_buf maybeCancellable maybeCallback user_data touchManagedPtr _obj whenJust stdin_buf touchManagedPtr whenJust cancellable touchManagedPtr return () -- method Subprocess::communicate_finish -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdout_buf", argType = TInterface "GLib" "Bytes", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "stderr_buf", argType = TInterface "GLib" "Bytes", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_subprocess_communicate_finish" g_subprocess_communicate_finish :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult" Ptr (Ptr GLib.Bytes) -> -- stdout_buf : TInterface "GLib" "Bytes" Ptr (Ptr GLib.Bytes) -> -- stderr_buf : TInterface "GLib" "Bytes" Ptr (Ptr GError) -> -- error IO CInt subprocessCommunicateFinish :: (MonadIO m, SubprocessK a, AsyncResultK b) => a -> -- _obj b -> -- result m (GLib.Bytes,GLib.Bytes) subprocessCommunicateFinish _obj result_ = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let result_' = unsafeManagedPtrCastPtr result_ stdout_buf <- allocMem :: IO (Ptr (Ptr GLib.Bytes)) stderr_buf <- allocMem :: IO (Ptr (Ptr GLib.Bytes)) onException (do _ <- propagateGError $ g_subprocess_communicate_finish _obj' result_' stdout_buf stderr_buf stdout_buf' <- peek stdout_buf stdout_buf'' <- (wrapBoxed GLib.Bytes) stdout_buf' stderr_buf' <- peek stderr_buf stderr_buf'' <- (wrapBoxed GLib.Bytes) stderr_buf' touchManagedPtr _obj touchManagedPtr result_ freeMem stdout_buf freeMem stderr_buf return (stdout_buf'', stderr_buf'') ) (do freeMem stdout_buf freeMem stderr_buf ) -- method Subprocess::communicate_utf8 -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdin_buf", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdout_buf", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "stderr_buf", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdin_buf", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_subprocess_communicate_utf8" g_subprocess_communicate_utf8 :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" CString -> -- stdin_buf : TBasicType TUTF8 Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" Ptr CString -> -- stdout_buf : TBasicType TUTF8 Ptr CString -> -- stderr_buf : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CInt subprocessCommunicateUtf8 :: (MonadIO m, SubprocessK a, CancellableK b) => a -> -- _obj Maybe (T.Text) -> -- stdin_buf Maybe (b) -> -- cancellable m (T.Text,T.Text) subprocessCommunicateUtf8 _obj stdin_buf cancellable = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeStdin_buf <- case stdin_buf of Nothing -> return nullPtr Just jStdin_buf -> do jStdin_buf' <- textToCString jStdin_buf return jStdin_buf' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' stdout_buf <- allocMem :: IO (Ptr CString) stderr_buf <- allocMem :: IO (Ptr CString) onException (do _ <- propagateGError $ g_subprocess_communicate_utf8 _obj' maybeStdin_buf maybeCancellable stdout_buf stderr_buf stdout_buf' <- peek stdout_buf stdout_buf'' <- cstringToText stdout_buf' freeMem stdout_buf' stderr_buf' <- peek stderr_buf stderr_buf'' <- cstringToText stderr_buf' freeMem stderr_buf' touchManagedPtr _obj whenJust cancellable touchManagedPtr freeMem maybeStdin_buf freeMem stdout_buf freeMem stderr_buf return (stdout_buf'', stderr_buf'') ) (do freeMem maybeStdin_buf freeMem stdout_buf freeMem stderr_buf ) -- method Subprocess::communicate_utf8_async -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdin_buf", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdin_buf", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 4, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_subprocess_communicate_utf8_async" g_subprocess_communicate_utf8_async :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" CString -> -- stdin_buf : TBasicType TUTF8 Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback" Ptr () -> -- user_data : TBasicType TVoid IO () subprocessCommunicateUtf8Async :: (MonadIO m, SubprocessK a, CancellableK b) => a -> -- _obj Maybe (T.Text) -> -- stdin_buf Maybe (b) -> -- cancellable Maybe (AsyncReadyCallback) -> -- callback m () subprocessCommunicateUtf8Async _obj stdin_buf cancellable callback = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeStdin_buf <- case stdin_buf of Nothing -> return nullPtr Just jStdin_buf -> do jStdin_buf' <- textToCString jStdin_buf return jStdin_buf' maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback) poke ptrcallback jCallback' return jCallback' let user_data = nullPtr g_subprocess_communicate_utf8_async _obj' maybeStdin_buf maybeCancellable maybeCallback user_data touchManagedPtr _obj whenJust cancellable touchManagedPtr freeMem maybeStdin_buf return () -- method Subprocess::communicate_utf8_finish -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "stdout_buf", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "stderr_buf", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_subprocess_communicate_utf8_finish" g_subprocess_communicate_utf8_finish :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult" Ptr CString -> -- stdout_buf : TBasicType TUTF8 Ptr CString -> -- stderr_buf : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO CInt subprocessCommunicateUtf8Finish :: (MonadIO m, SubprocessK a, AsyncResultK b) => a -> -- _obj b -> -- result m (T.Text,T.Text) subprocessCommunicateUtf8Finish _obj result_ = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let result_' = unsafeManagedPtrCastPtr result_ stdout_buf <- allocMem :: IO (Ptr CString) stderr_buf <- allocMem :: IO (Ptr CString) onException (do _ <- propagateGError $ g_subprocess_communicate_utf8_finish _obj' result_' stdout_buf stderr_buf stdout_buf' <- peek stdout_buf stdout_buf'' <- cstringToText stdout_buf' freeMem stdout_buf' stderr_buf' <- peek stderr_buf stderr_buf'' <- cstringToText stderr_buf' freeMem stderr_buf' touchManagedPtr _obj touchManagedPtr result_ freeMem stdout_buf freeMem stderr_buf return (stdout_buf'', stderr_buf'') ) (do freeMem stdout_buf freeMem stderr_buf ) -- method Subprocess::force_exit -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_subprocess_force_exit" g_subprocess_force_exit :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO () subprocessForceExit :: (MonadIO m, SubprocessK a) => a -> -- _obj m () subprocessForceExit _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj g_subprocess_force_exit _obj' touchManagedPtr _obj return () -- method Subprocess::get_exit_status -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_exit_status" g_subprocess_get_exit_status :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO Int32 subprocessGetExitStatus :: (MonadIO m, SubprocessK a) => a -> -- _obj m Int32 subprocessGetExitStatus _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_exit_status _obj' touchManagedPtr _obj return result -- method Subprocess::get_identifier -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_identifier" g_subprocess_get_identifier :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO CString subprocessGetIdentifier :: (MonadIO m, SubprocessK a) => a -> -- _obj m T.Text subprocessGetIdentifier _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_identifier _obj' checkUnexpectedReturnNULL "g_subprocess_get_identifier" result result' <- cstringToText result touchManagedPtr _obj return result' -- method Subprocess::get_if_exited -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_if_exited" g_subprocess_get_if_exited :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO CInt subprocessGetIfExited :: (MonadIO m, SubprocessK a) => a -> -- _obj m Bool subprocessGetIfExited _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_if_exited _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Subprocess::get_if_signaled -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_if_signaled" g_subprocess_get_if_signaled :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO CInt subprocessGetIfSignaled :: (MonadIO m, SubprocessK a) => a -> -- _obj m Bool subprocessGetIfSignaled _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_if_signaled _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Subprocess::get_status -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_status" g_subprocess_get_status :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO Int32 subprocessGetStatus :: (MonadIO m, SubprocessK a) => a -> -- _obj m Int32 subprocessGetStatus _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_status _obj' touchManagedPtr _obj return result -- method Subprocess::get_stderr_pipe -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "InputStream" -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_stderr_pipe" g_subprocess_get_stderr_pipe :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO (Ptr InputStream) subprocessGetStderrPipe :: (MonadIO m, SubprocessK a) => a -> -- _obj m InputStream subprocessGetStderrPipe _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_stderr_pipe _obj' checkUnexpectedReturnNULL "g_subprocess_get_stderr_pipe" result result' <- (newObject InputStream) result touchManagedPtr _obj return result' -- method Subprocess::get_stdin_pipe -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "OutputStream" -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_stdin_pipe" g_subprocess_get_stdin_pipe :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO (Ptr OutputStream) subprocessGetStdinPipe :: (MonadIO m, SubprocessK a) => a -> -- _obj m OutputStream subprocessGetStdinPipe _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_stdin_pipe _obj' checkUnexpectedReturnNULL "g_subprocess_get_stdin_pipe" result result' <- (newObject OutputStream) result touchManagedPtr _obj return result' -- method Subprocess::get_stdout_pipe -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gio" "InputStream" -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_stdout_pipe" g_subprocess_get_stdout_pipe :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO (Ptr InputStream) subprocessGetStdoutPipe :: (MonadIO m, SubprocessK a) => a -> -- _obj m InputStream subprocessGetStdoutPipe _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_stdout_pipe _obj' checkUnexpectedReturnNULL "g_subprocess_get_stdout_pipe" result result' <- (newObject InputStream) result touchManagedPtr _obj return result' -- method Subprocess::get_successful -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_successful" g_subprocess_get_successful :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO CInt subprocessGetSuccessful :: (MonadIO m, SubprocessK a) => a -> -- _obj m Bool subprocessGetSuccessful _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_successful _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Subprocess::get_term_sig -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "g_subprocess_get_term_sig" g_subprocess_get_term_sig :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" IO Int32 subprocessGetTermSig :: (MonadIO m, SubprocessK a) => a -> -- _obj m Int32 subprocessGetTermSig _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- g_subprocess_get_term_sig _obj' touchManagedPtr _obj return result -- method Subprocess::send_signal -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "signal_num", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "signal_num", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_subprocess_send_signal" g_subprocess_send_signal :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Int32 -> -- signal_num : TBasicType TInt32 IO () subprocessSendSignal :: (MonadIO m, SubprocessK a) => a -> -- _obj Int32 -> -- signal_num m () subprocessSendSignal _obj signal_num = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj g_subprocess_send_signal _obj' signal_num touchManagedPtr _obj return () -- method Subprocess::wait -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_subprocess_wait" g_subprocess_wait :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" Ptr (Ptr GError) -> -- error IO CInt subprocessWait :: (MonadIO m, SubprocessK a, CancellableK b) => a -> -- _obj Maybe (b) -> -- cancellable m () subprocessWait _obj cancellable = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' onException (do _ <- propagateGError $ g_subprocess_wait _obj' maybeCancellable touchManagedPtr _obj whenJust cancellable touchManagedPtr return () ) (do return () ) -- method Subprocess::wait_async -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_subprocess_wait_async" g_subprocess_wait_async :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback" Ptr () -> -- user_data : TBasicType TVoid IO () subprocessWaitAsync :: (MonadIO m, SubprocessK a, CancellableK b) => a -> -- _obj Maybe (b) -> -- cancellable Maybe (AsyncReadyCallback) -> -- callback m () subprocessWaitAsync _obj cancellable callback = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback) poke ptrcallback jCallback' return jCallback' let user_data = nullPtr g_subprocess_wait_async _obj' maybeCancellable maybeCallback user_data touchManagedPtr _obj whenJust cancellable touchManagedPtr return () -- method Subprocess::wait_check -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_subprocess_wait_check" g_subprocess_wait_check :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" Ptr (Ptr GError) -> -- error IO CInt subprocessWaitCheck :: (MonadIO m, SubprocessK a, CancellableK b) => a -> -- _obj Maybe (b) -> -- cancellable m () subprocessWaitCheck _obj cancellable = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' onException (do _ <- propagateGError $ g_subprocess_wait_check _obj' maybeCancellable touchManagedPtr _obj whenJust cancellable touchManagedPtr return () ) (do return () ) -- method Subprocess::wait_check_async -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cancellable", argType = TInterface "Gio" "Cancellable", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "callback", argType = TInterface "Gio" "AsyncReadyCallback", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeAsync, argClosure = 3, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "g_subprocess_wait_check_async" g_subprocess_wait_check_async :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr Cancellable -> -- cancellable : TInterface "Gio" "Cancellable" FunPtr AsyncReadyCallbackC -> -- callback : TInterface "Gio" "AsyncReadyCallback" Ptr () -> -- user_data : TBasicType TVoid IO () subprocessWaitCheckAsync :: (MonadIO m, SubprocessK a, CancellableK b) => a -> -- _obj Maybe (b) -> -- cancellable Maybe (AsyncReadyCallback) -> -- callback m () subprocessWaitCheckAsync _obj cancellable callback = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybeCancellable <- case cancellable of Nothing -> return nullPtr Just jCancellable -> do let jCancellable' = unsafeManagedPtrCastPtr jCancellable return jCancellable' ptrcallback <- callocMem :: IO (Ptr (FunPtr AsyncReadyCallbackC)) maybeCallback <- case callback of Nothing -> return (castPtrToFunPtr nullPtr) Just jCallback -> do jCallback' <- mkAsyncReadyCallback (asyncReadyCallbackWrapper (Just ptrcallback) jCallback) poke ptrcallback jCallback' return jCallback' let user_data = nullPtr g_subprocess_wait_check_async _obj' maybeCancellable maybeCallback user_data touchManagedPtr _obj whenJust cancellable touchManagedPtr return () -- method Subprocess::wait_check_finish -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_subprocess_wait_check_finish" g_subprocess_wait_check_finish :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult" Ptr (Ptr GError) -> -- error IO CInt subprocessWaitCheckFinish :: (MonadIO m, SubprocessK a, AsyncResultK b) => a -> -- _obj b -> -- result m () subprocessWaitCheckFinish _obj result_ = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let result_' = unsafeManagedPtrCastPtr result_ onException (do _ <- propagateGError $ g_subprocess_wait_check_finish _obj' result_' touchManagedPtr _obj touchManagedPtr result_ return () ) (do return () ) -- method Subprocess::wait_finish -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Subprocess", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "result", argType = TInterface "Gio" "AsyncResult", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : True -- Skip return : False foreign import ccall "g_subprocess_wait_finish" g_subprocess_wait_finish :: Ptr Subprocess -> -- _obj : TInterface "Gio" "Subprocess" Ptr AsyncResult -> -- result : TInterface "Gio" "AsyncResult" Ptr (Ptr GError) -> -- error IO CInt subprocessWaitFinish :: (MonadIO m, SubprocessK a, AsyncResultK b) => a -> -- _obj b -> -- result m () subprocessWaitFinish _obj result_ = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let result_' = unsafeManagedPtrCastPtr result_ onException (do _ <- propagateGError $ g_subprocess_wait_finish _obj' result_' touchManagedPtr _obj touchManagedPtr result_ return () ) (do return () )