1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/glib"
11 "github.com/bnema/puregotk/v4/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// `GSubprocess` allows the creation of and interaction with child
16// processes.
17//
18// Processes can be communicated with using standard GIO-style APIs (ie:
19// [class@Gio.InputStream], [class@Gio.OutputStream]). There are GIO-style APIs
20// to wait for process termination (ie: cancellable and with an asynchronous
21// variant).
22//
23// There is an API to force a process to terminate, as well as a
24// race-free API for sending UNIX signals to a subprocess.
25//
26// One major advantage that GIO brings over the core GLib library is
27// comprehensive API for asynchronous I/O, such
28// [method@Gio.OutputStream.splice_async]. This makes `GSubprocess`
29// significantly more powerful and flexible than equivalent APIs in
30// some other languages such as the `subprocess.py`
31// included with Python. For example, using `GSubprocess` one could
32// create two child processes, reading standard output from the first,
33// processing it, and writing to the input stream of the second, all
34// without blocking the main loop.
35//
36// A powerful [method@Gio.Subprocess.communicate] API is provided similar to the
37// `communicate()` method of `subprocess.py`. This enables very easy
38// interaction with a subprocess that has been opened with pipes.
39//
40// `GSubprocess` defaults to tight control over the file descriptors open
41// in the child process, avoiding dangling-FD issues that are caused by
42// a simple `fork()`/`exec()`. The only open file descriptors in the
43// spawned process are ones that were explicitly specified by the
44// `GSubprocess` API (unless `G_SUBPROCESS_FLAGS_INHERIT_FDS` was
45// specified).
46//
47// `GSubprocess` will quickly reap all child processes as they exit,
48// avoiding ‘zombie processes’ remaining around for long periods of
49// time. [method@Gio.Subprocess.wait] can be used to wait for this to happen,
50// but it will happen even without the call being explicitly made.
51//
52// As a matter of principle, `GSubprocess` has no API that accepts
53// shell-style space-separated strings. It will, however, match the
54// typical shell behaviour of searching the `PATH` for executables that do
55// not contain a directory separator in their name. By default, the `PATH`
56// of the current process is used. You can specify
57// `G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP` to use the `PATH` of the
58// launcher environment instead.
59//
60// `GSubprocess` attempts to have a very simple API for most uses (ie:
61// spawning a subprocess with arguments and support for most typical
62// kinds of input and output redirection). See [ctor@Gio.Subprocess.new]. The
63// [class@Gio.SubprocessLauncher] API is provided for more complicated cases
64// (advanced types of redirection, environment variable manipulation,
65// change of working directory, child setup functions, etc).
66//
67// A typical use of `GSubprocess` will involve calling
68// [ctor@Gio.Subprocess.new], followed by [method@Gio.Subprocess.wait_async] or
69// [method@Gio.Subprocess.wait]. After the process exits, the status can be
70// checked using functions such as [method@Gio.Subprocess.get_if_exited] (which
71// are similar to the familiar `WIFEXITED`-style POSIX macros).
72//
73// Note that as of GLib 2.82, creating a `GSubprocess` causes the signal
74// `SIGPIPE` to be ignored for the remainder of the program. If you are writing
75// a command-line utility that uses `GSubprocess`, you may need to take into
76// account the fact that your program will not automatically be killed
77// if it tries to write to `stdout` after it has been closed.
78type Subprocess struct {
79 gobject.Object
80}
81
82var xSubprocessGLibType func() types.GType
83
84func SubprocessGLibType() types.GType {
85 return xSubprocessGLibType()
86}
87
88func SubprocessNewFromInternalPtr(ptr uintptr) *Subprocess {
89 cls := &Subprocess{}
90 cls.Ptr = ptr
91 return cls
92}
93
94var xNewSubprocess func(SubprocessFlags, **glib.Error, string, ...interface{}) uintptr
95
96// Create a new process with the given flags and varargs argument
97// list. By default, matching the g_spawn_async() defaults, the
98// child's stdin will be set to the system null device, and
99// stdout/stderr will be inherited from the parent. You can use
100// @flags to control this behavior.
101//
102// The argument list must be terminated with %NULL.
103func NewSubprocess(FlagsVar SubprocessFlags, ErrorVar **glib.Error, Argv0Var string, varArgs ...interface{}) *Subprocess {
104 var cls *Subprocess
105
106 cret := xNewSubprocess(FlagsVar, ErrorVar, Argv0Var, varArgs...)
107
108 if cret == 0 {
109 return nil
110 }
111 cls = &Subprocess{}
112 cls.Ptr = cret
113 return cls
114}
115
116var xNewSubprocessv func([]string, SubprocessFlags, **glib.Error) uintptr
117
118// Create a new process with the given flags and argument list.
119//
120// The argument list is expected to be %NULL-terminated.
121func NewSubprocessv(ArgvVar []string, FlagsVar SubprocessFlags) (*Subprocess, error) {
122 var cls *Subprocess
123 var cerr *glib.Error
124
125 cret := xNewSubprocessv(ArgvVar, FlagsVar, &cerr)
126
127 if cret == 0 {
128 return nil, cerr
129 }
130 cls = &Subprocess{}
131 cls.Ptr = cret
132 if cerr == nil {
133 return cls, nil
134 }
135 return cls, cerr
136
137}
138
139var xSubprocessCommunicate func(uintptr, *glib.Bytes, uintptr, **glib.Bytes, **glib.Bytes, **glib.Error) bool
140
141// Communicate with the subprocess until it terminates, and all input
142// and output has been completed.
143//
144// If @stdin_buf is given, the subprocess must have been created with
145// %G_SUBPROCESS_FLAGS_STDIN_PIPE. The given data is fed to the
146// stdin of the subprocess and the pipe is closed (ie: EOF).
147//
148// At the same time (as not to cause blocking when dealing with large
149// amounts of data), if %G_SUBPROCESS_FLAGS_STDOUT_PIPE or
150// %G_SUBPROCESS_FLAGS_STDERR_PIPE were used, reads from those
151// streams. The data that was read is returned in @stdout and/or
152// the @stderr.
153//
154// If the subprocess was created with %G_SUBPROCESS_FLAGS_STDOUT_PIPE,
155// @stdout_buf will contain the data read from stdout. Otherwise, for
156// subprocesses not created with %G_SUBPROCESS_FLAGS_STDOUT_PIPE,
157// @stdout_buf will be set to %NULL. Similar provisions apply to
158// @stderr_buf and %G_SUBPROCESS_FLAGS_STDERR_PIPE.
159//
160// As usual, any output variable may be given as %NULL to ignore it.
161//
162// If you desire the stdout and stderr data to be interleaved, create
163// the subprocess with %G_SUBPROCESS_FLAGS_STDOUT_PIPE and
164// %G_SUBPROCESS_FLAGS_STDERR_MERGE. The merged result will be returned
165// in @stdout_buf and @stderr_buf will be set to %NULL.
166//
167// In case of any error (including cancellation), %FALSE will be
168// returned with @error set. Some or all of the stdin data may have
169// been written. Any stdout or stderr data that has been read will be
170// discarded. None of the out variables (aside from @error) will have
171// been set to anything in particular and should not be inspected.
172//
173// In the case that %TRUE is returned, the subprocess has exited and the
174// exit status inspection APIs (eg: g_subprocess_get_if_exited(),
175// g_subprocess_get_exit_status()) may be used.
176//
177// You should not attempt to use any of the subprocess pipes after
178// starting this function, since they may be left in strange states,
179// even if the operation was cancelled. You should especially not
180// attempt to interact with the pipes while the operation is in progress
181// (either from another thread or if using the asynchronous version).
182func (x *Subprocess) Communicate(StdinBufVar *glib.Bytes, CancellableVar *Cancellable, StdoutBufVar **glib.Bytes, StderrBufVar **glib.Bytes) (bool, error) {
183 var cerr *glib.Error
184
185 cret := xSubprocessCommunicate(x.GoPointer(), StdinBufVar, CancellableVar.GoPointer(), StdoutBufVar, StderrBufVar, &cerr)
186 if cerr == nil {
187 return cret, nil
188 }
189 return cret, cerr
190
191}
192
193var xSubprocessCommunicateAsync func(uintptr, *glib.Bytes, uintptr, uintptr, uintptr)
194
195// Asynchronous version of g_subprocess_communicate(). Complete
196// invocation with g_subprocess_communicate_finish().
197func (x *Subprocess) CommunicateAsync(StdinBufVar *glib.Bytes, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
198
199 var CallbackVarRef uintptr
200 if CallbackVar != nil {
201 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
202 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
203 CallbackVarRef = cbRefPtr
204 } else {
205 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
206 cbFn := *CallbackVar
207 cbFn(arg0, arg1, arg2)
208 }
209 CallbackVarRef = purego.NewCallback(fcb)
210 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
211 }
212 }
213
214 xSubprocessCommunicateAsync(x.GoPointer(), StdinBufVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
215
216}
217
218var xSubprocessCommunicateFinish func(uintptr, uintptr, **glib.Bytes, **glib.Bytes, **glib.Error) bool
219
220// Complete an invocation of g_subprocess_communicate_async().
221func (x *Subprocess) CommunicateFinish(ResultVar AsyncResult, StdoutBufVar **glib.Bytes, StderrBufVar **glib.Bytes) (bool, error) {
222 var cerr *glib.Error
223
224 cret := xSubprocessCommunicateFinish(x.GoPointer(), ResultVar.GoPointer(), StdoutBufVar, StderrBufVar, &cerr)
225 if cerr == nil {
226 return cret, nil
227 }
228 return cret, cerr
229
230}
231
232var xSubprocessCommunicateUtf8 func(uintptr, uintptr, uintptr, *string, *string, **glib.Error) bool
233
234// Like g_subprocess_communicate(), but validates the output of the
235// process as UTF-8, and returns it as a regular NUL terminated string.
236//
237// On error, @stdout_buf and @stderr_buf will be set to undefined values and
238// should not be used.
239func (x *Subprocess) CommunicateUtf8(StdinBufVar *string, CancellableVar *Cancellable, StdoutBufVar *string, StderrBufVar *string) (bool, error) {
240 var cerr *glib.Error
241
242 StdinBufVarPtr := core.GStrdupNullable(StdinBufVar)
243 defer core.GFreeNullable(StdinBufVarPtr)
244
245 cret := xSubprocessCommunicateUtf8(x.GoPointer(), StdinBufVarPtr, CancellableVar.GoPointer(), StdoutBufVar, StderrBufVar, &cerr)
246 if cerr == nil {
247 return cret, nil
248 }
249 return cret, cerr
250
251}
252
253var xSubprocessCommunicateUtf8Async func(uintptr, uintptr, uintptr, uintptr, uintptr)
254
255// Asynchronous version of g_subprocess_communicate_utf8(). Complete
256// invocation with g_subprocess_communicate_utf8_finish().
257func (x *Subprocess) CommunicateUtf8Async(StdinBufVar *string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
258
259 var CallbackVarRef uintptr
260 if CallbackVar != nil {
261 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
262 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
263 CallbackVarRef = cbRefPtr
264 } else {
265 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
266 cbFn := *CallbackVar
267 cbFn(arg0, arg1, arg2)
268 }
269 CallbackVarRef = purego.NewCallback(fcb)
270 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
271 }
272 }
273
274 StdinBufVarPtr := core.GStrdupNullable(StdinBufVar)
275 defer core.GFreeNullable(StdinBufVarPtr)
276
277 xSubprocessCommunicateUtf8Async(x.GoPointer(), StdinBufVarPtr, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
278
279}
280
281var xSubprocessCommunicateUtf8Finish func(uintptr, uintptr, *string, *string, **glib.Error) bool
282
283// Complete an invocation of g_subprocess_communicate_utf8_async().
284func (x *Subprocess) CommunicateUtf8Finish(ResultVar AsyncResult, StdoutBufVar *string, StderrBufVar *string) (bool, error) {
285 var cerr *glib.Error
286
287 cret := xSubprocessCommunicateUtf8Finish(x.GoPointer(), ResultVar.GoPointer(), StdoutBufVar, StderrBufVar, &cerr)
288 if cerr == nil {
289 return cret, nil
290 }
291 return cret, cerr
292
293}
294
295var xSubprocessForceExit func(uintptr)
296
297// Use an operating-system specific method to attempt an immediate,
298// forceful termination of the process. There is no mechanism to
299// determine whether or not the request itself was successful;
300// however, you can use g_subprocess_wait() to monitor the status of
301// the process after calling this function.
302//
303// On Unix, this function sends %SIGKILL.
304func (x *Subprocess) ForceExit() {
305
306 xSubprocessForceExit(x.GoPointer())
307
308}
309
310var xSubprocessGetExitStatus func(uintptr) int
311
312// Check the exit status of the subprocess, given that it exited
313// normally. This is the value passed to the exit() system call or the
314// return value from main.
315//
316// This is equivalent to the system WEXITSTATUS macro.
317//
318// It is an error to call this function before g_subprocess_wait() and
319// unless g_subprocess_get_if_exited() returned %TRUE.
320func (x *Subprocess) GetExitStatus() int {
321
322 cret := xSubprocessGetExitStatus(x.GoPointer())
323 return cret
324}
325
326var xSubprocessGetIdentifier func(uintptr) string
327
328// On UNIX, returns the process ID as a decimal string.
329// On Windows, returns the result of GetProcessId() also as a string.
330// If the subprocess has terminated, this will return %NULL.
331func (x *Subprocess) GetIdentifier() string {
332
333 cret := xSubprocessGetIdentifier(x.GoPointer())
334 return cret
335}
336
337var xSubprocessGetIfExited func(uintptr) bool
338
339// Check if the given subprocess exited normally (ie: by way of exit()
340// or return from main()).
341//
342// This is equivalent to the system WIFEXITED macro.
343//
344// It is an error to call this function before g_subprocess_wait() has
345// returned.
346func (x *Subprocess) GetIfExited() bool {
347
348 cret := xSubprocessGetIfExited(x.GoPointer())
349 return cret
350}
351
352var xSubprocessGetIfSignaled func(uintptr) bool
353
354// Check if the given subprocess terminated in response to a signal.
355//
356// This is equivalent to the system WIFSIGNALED macro.
357//
358// It is an error to call this function before g_subprocess_wait() has
359// returned.
360func (x *Subprocess) GetIfSignaled() bool {
361
362 cret := xSubprocessGetIfSignaled(x.GoPointer())
363 return cret
364}
365
366var xSubprocessGetStatus func(uintptr) int
367
368// Gets the raw status code of the process, as from waitpid().
369//
370// This value has no particular meaning, but it can be used with the
371// macros defined by the system headers such as WIFEXITED. It can also
372// be used with g_spawn_check_wait_status().
373//
374// It is more likely that you want to use g_subprocess_get_if_exited()
375// followed by g_subprocess_get_exit_status().
376//
377// It is an error to call this function before g_subprocess_wait() has
378// returned.
379func (x *Subprocess) GetStatus() int {
380
381 cret := xSubprocessGetStatus(x.GoPointer())
382 return cret
383}
384
385var xSubprocessGetStderrPipe func(uintptr) uintptr
386
387// Gets the #GInputStream from which to read the stderr output of
388// @subprocess.
389//
390// The process must have been created with %G_SUBPROCESS_FLAGS_STDERR_PIPE,
391// otherwise %NULL will be returned.
392func (x *Subprocess) GetStderrPipe() *InputStream {
393 var cls *InputStream
394
395 cret := xSubprocessGetStderrPipe(x.GoPointer())
396
397 if cret == 0 {
398 return nil
399 }
400 gobject.IncreaseRef(cret)
401 cls = &InputStream{}
402 cls.Ptr = cret
403 return cls
404}
405
406var xSubprocessGetStdinPipe func(uintptr) uintptr
407
408// Gets the #GOutputStream that you can write to in order to give data
409// to the stdin of @subprocess.
410//
411// The process must have been created with %G_SUBPROCESS_FLAGS_STDIN_PIPE and
412// not %G_SUBPROCESS_FLAGS_STDIN_INHERIT, otherwise %NULL will be returned.
413func (x *Subprocess) GetStdinPipe() *OutputStream {
414 var cls *OutputStream
415
416 cret := xSubprocessGetStdinPipe(x.GoPointer())
417
418 if cret == 0 {
419 return nil
420 }
421 gobject.IncreaseRef(cret)
422 cls = &OutputStream{}
423 cls.Ptr = cret
424 return cls
425}
426
427var xSubprocessGetStdoutPipe func(uintptr) uintptr
428
429// Gets the #GInputStream from which to read the stdout output of
430// @subprocess.
431//
432// The process must have been created with %G_SUBPROCESS_FLAGS_STDOUT_PIPE,
433// otherwise %NULL will be returned.
434func (x *Subprocess) GetStdoutPipe() *InputStream {
435 var cls *InputStream
436
437 cret := xSubprocessGetStdoutPipe(x.GoPointer())
438
439 if cret == 0 {
440 return nil
441 }
442 gobject.IncreaseRef(cret)
443 cls = &InputStream{}
444 cls.Ptr = cret
445 return cls
446}
447
448var xSubprocessGetSuccessful func(uintptr) bool
449
450// Checks if the process was "successful". A process is considered
451// successful if it exited cleanly with an exit status of 0, either by
452// way of the exit() system call or return from main().
453//
454// It is an error to call this function before g_subprocess_wait() has
455// returned.
456func (x *Subprocess) GetSuccessful() bool {
457
458 cret := xSubprocessGetSuccessful(x.GoPointer())
459 return cret
460}
461
462var xSubprocessGetTermSig func(uintptr) int
463
464// Get the signal number that caused the subprocess to terminate, given
465// that it terminated due to a signal.
466//
467// This is equivalent to the system WTERMSIG macro.
468//
469// It is an error to call this function before g_subprocess_wait() and
470// unless g_subprocess_get_if_signaled() returned %TRUE.
471func (x *Subprocess) GetTermSig() int {
472
473 cret := xSubprocessGetTermSig(x.GoPointer())
474 return cret
475}
476
477var xSubprocessSendSignal func(uintptr, int)
478
479// Sends the UNIX signal @signal_num to the subprocess, if it is still
480// running.
481//
482// This API is race-free. If the subprocess has terminated, it will not
483// be signalled.
484//
485// This API is not available on Windows.
486func (x *Subprocess) SendSignal(SignalNumVar int) {
487
488 xSubprocessSendSignal(x.GoPointer(), SignalNumVar)
489
490}
491
492var xSubprocessWait func(uintptr, uintptr, **glib.Error) bool
493
494// Synchronously wait for the subprocess to terminate.
495//
496// After the process terminates you can query its exit status with
497// functions such as g_subprocess_get_if_exited() and
498// g_subprocess_get_exit_status().
499//
500// This function does not fail in the case of the subprocess having
501// abnormal termination. See g_subprocess_wait_check() for that.
502//
503// Cancelling @cancellable doesn't kill the subprocess. Call
504// g_subprocess_force_exit() if it is desirable.
505func (x *Subprocess) Wait(CancellableVar *Cancellable) (bool, error) {
506 var cerr *glib.Error
507
508 cret := xSubprocessWait(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
509 if cerr == nil {
510 return cret, nil
511 }
512 return cret, cerr
513
514}
515
516var xSubprocessWaitAsync func(uintptr, uintptr, uintptr, uintptr)
517
518// Wait for the subprocess to terminate.
519//
520// This is the asynchronous version of g_subprocess_wait().
521func (x *Subprocess) WaitAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
522
523 var CallbackVarRef uintptr
524 if CallbackVar != nil {
525 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
526 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
527 CallbackVarRef = cbRefPtr
528 } else {
529 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
530 cbFn := *CallbackVar
531 cbFn(arg0, arg1, arg2)
532 }
533 CallbackVarRef = purego.NewCallback(fcb)
534 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
535 }
536 }
537
538 xSubprocessWaitAsync(x.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
539
540}
541
542var xSubprocessWaitCheck func(uintptr, uintptr, **glib.Error) bool
543
544// Combines g_subprocess_wait() with g_spawn_check_wait_status().
545func (x *Subprocess) WaitCheck(CancellableVar *Cancellable) (bool, error) {
546 var cerr *glib.Error
547
548 cret := xSubprocessWaitCheck(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
549 if cerr == nil {
550 return cret, nil
551 }
552 return cret, cerr
553
554}
555
556var xSubprocessWaitCheckAsync func(uintptr, uintptr, uintptr, uintptr)
557
558// Combines g_subprocess_wait_async() with g_spawn_check_wait_status().
559//
560// This is the asynchronous version of g_subprocess_wait_check().
561func (x *Subprocess) WaitCheckAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
562
563 var CallbackVarRef uintptr
564 if CallbackVar != nil {
565 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
566 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
567 CallbackVarRef = cbRefPtr
568 } else {
569 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
570 cbFn := *CallbackVar
571 cbFn(arg0, arg1, arg2)
572 }
573 CallbackVarRef = purego.NewCallback(fcb)
574 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
575 }
576 }
577
578 xSubprocessWaitCheckAsync(x.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
579
580}
581
582var xSubprocessWaitCheckFinish func(uintptr, uintptr, **glib.Error) bool
583
584// Collects the result of a previous call to
585// g_subprocess_wait_check_async().
586func (x *Subprocess) WaitCheckFinish(ResultVar AsyncResult) (bool, error) {
587 var cerr *glib.Error
588
589 cret := xSubprocessWaitCheckFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
590 if cerr == nil {
591 return cret, nil
592 }
593 return cret, cerr
594
595}
596
597var xSubprocessWaitFinish func(uintptr, uintptr, **glib.Error) bool
598
599// Collects the result of a previous call to
600// g_subprocess_wait_async().
601func (x *Subprocess) WaitFinish(ResultVar AsyncResult) (bool, error) {
602 var cerr *glib.Error
603
604 cret := xSubprocessWaitFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
605 if cerr == nil {
606 return cret, nil
607 }
608 return cret, cerr
609
610}
611
612func (c *Subprocess) GoPointer() uintptr {
613 if c == nil {
614 return 0
615 }
616 return c.Ptr
617}
618
619func (c *Subprocess) SetGoPointer(ptr uintptr) {
620 c.Ptr = ptr
621}
622
623// SetPropertyArgv sets the "argv" property.
624// Argument vector.
625func (x *Subprocess) SetPropertyArgv(value []string) {
626 var v gobject.Value
627 v.Init(glib.StrvGetType())
628 v.SetBoxed(uintptr(unsafe.Pointer(core.ByteSlice(value))))
629 x.SetProperty("argv", &v)
630}
631
632// Initializes the object implementing the interface.
633//
634// This method is intended for language bindings. If writing in C,
635// g_initable_new() should typically be used instead.
636//
637// The object must be initialized before any real use after initial
638// construction, either with this function or g_async_initable_init_async().
639//
640// Implementations may also support cancellation. If @cancellable is not %NULL,
641// then initialization can be cancelled by triggering the cancellable object
642// from another thread. If the operation was cancelled, the error
643// %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL and
644// the object doesn't support cancellable initialization the error
645// %G_IO_ERROR_NOT_SUPPORTED will be returned.
646//
647// If the object is not initialized, or initialization returns with an
648// error, then all operations on the object except g_object_ref() and
649// g_object_unref() are considered to be invalid, and have undefined
650// behaviour. See the [description][iface@Gio.Initable#description] for more details.
651//
652// Callers should not assume that a class which implements #GInitable can be
653// initialized multiple times, unless the class explicitly documents itself as
654// supporting this. Generally, a class’ implementation of init() can assume
655// (and assert) that it will only be called once. Previously, this documentation
656// recommended all #GInitable implementations should be idempotent; that
657// recommendation was relaxed in GLib 2.54.
658//
659// If a class explicitly supports being initialized multiple times, it is
660// recommended that the method is idempotent: multiple calls with the same
661// arguments should return the same results. Only the first call initializes
662// the object; further calls return the result of the first call.
663//
664// One reason why a class might need to support idempotent initialization is if
665// it is designed to be used via the singleton pattern, with a
666// #GObjectClass.constructor that sometimes returns an existing instance.
667// In this pattern, a caller would expect to be able to call g_initable_init()
668// on the result of g_object_new(), regardless of whether it is in fact a new
669// instance.
670func (x *Subprocess) Init(CancellableVar *Cancellable) (bool, error) {
671 var cerr *glib.Error
672
673 cret := XGInitableInit(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
674 if cerr == nil {
675 return cret, nil
676 }
677 return cret, cerr
678
679}
680
681func init() {
682 core.SetPackageName("GIO", "gio-2.0")
683 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
684 var libs []uintptr
685 for _, libPath := range core.GetPaths("GIO") {
686 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
687 if err != nil {
688 panic(err)
689 }
690 libs = append(libs, lib)
691 }
692
693 core.PuregoSafeRegister(&xSubprocessGLibType, libs, "g_subprocess_get_type")
694
695 core.PuregoSafeRegister(&xNewSubprocess, libs, "g_subprocess_new")
696 core.PuregoSafeRegister(&xNewSubprocessv, libs, "g_subprocess_newv")
697
698 core.PuregoSafeRegister(&xSubprocessCommunicate, libs, "g_subprocess_communicate")
699 core.PuregoSafeRegister(&xSubprocessCommunicateAsync, libs, "g_subprocess_communicate_async")
700 core.PuregoSafeRegister(&xSubprocessCommunicateFinish, libs, "g_subprocess_communicate_finish")
701 core.PuregoSafeRegister(&xSubprocessCommunicateUtf8, libs, "g_subprocess_communicate_utf8")
702 core.PuregoSafeRegister(&xSubprocessCommunicateUtf8Async, libs, "g_subprocess_communicate_utf8_async")
703 core.PuregoSafeRegister(&xSubprocessCommunicateUtf8Finish, libs, "g_subprocess_communicate_utf8_finish")
704 core.PuregoSafeRegister(&xSubprocessForceExit, libs, "g_subprocess_force_exit")
705 core.PuregoSafeRegister(&xSubprocessGetExitStatus, libs, "g_subprocess_get_exit_status")
706 core.PuregoSafeRegister(&xSubprocessGetIdentifier, libs, "g_subprocess_get_identifier")
707 core.PuregoSafeRegister(&xSubprocessGetIfExited, libs, "g_subprocess_get_if_exited")
708 core.PuregoSafeRegister(&xSubprocessGetIfSignaled, libs, "g_subprocess_get_if_signaled")
709 core.PuregoSafeRegister(&xSubprocessGetStatus, libs, "g_subprocess_get_status")
710 core.PuregoSafeRegister(&xSubprocessGetStderrPipe, libs, "g_subprocess_get_stderr_pipe")
711 core.PuregoSafeRegister(&xSubprocessGetStdinPipe, libs, "g_subprocess_get_stdin_pipe")
712 core.PuregoSafeRegister(&xSubprocessGetStdoutPipe, libs, "g_subprocess_get_stdout_pipe")
713 core.PuregoSafeRegister(&xSubprocessGetSuccessful, libs, "g_subprocess_get_successful")
714 core.PuregoSafeRegister(&xSubprocessGetTermSig, libs, "g_subprocess_get_term_sig")
715 core.PuregoSafeRegister(&xSubprocessSendSignal, libs, "g_subprocess_send_signal")
716 core.PuregoSafeRegister(&xSubprocessWait, libs, "g_subprocess_wait")
717 core.PuregoSafeRegister(&xSubprocessWaitAsync, libs, "g_subprocess_wait_async")
718 core.PuregoSafeRegister(&xSubprocessWaitCheck, libs, "g_subprocess_wait_check")
719 core.PuregoSafeRegister(&xSubprocessWaitCheckAsync, libs, "g_subprocess_wait_check_async")
720 core.PuregoSafeRegister(&xSubprocessWaitCheckFinish, libs, "g_subprocess_wait_check_finish")
721 core.PuregoSafeRegister(&xSubprocessWaitFinish, libs, "g_subprocess_wait_finish")
722
723}