summaryrefslogtreecommitdiff
path: root/gio/gsubprocesslauncher.c
AgeCommit message (Collapse)Author
2017-10-26introspection: Add more filename type annotations for strings which can ↵Christoph Reiter
contain filenames This continues the changes done in https://bugzilla.gnome.org/show_bug.cgi?id=767245 This makes it possible to pass Python path types as process arguments and env vars in PyGObject and and makes it clear that the values are not strictly utf-8 and need to be validated/converted first. https://bugzilla.gnome.org/show_bug.cgi?id=788863
2017-09-11Skip g_subprocess_launcher_set_child_setup() in introspectionMikhail Zabaluev
It's not likely that the runtime of a bound language using the introspection supports running in a process forked by a foreign library, so that a closure programmed in that language would work safely. Any programming environment supporting that would probably have its own advanced facilities for process spawning, or be able to access the GLib spawning APIs via raw C bindings (still represented in the introspection, (skip) only adds a flag) and do any low-level preparatory dances as necessary for the forked runtime. Note that there are other APIs making use of GSpawnChildSetupFunc, but they are usable with the closure nullified, and we cannot annotate the closure parameters away because that would break the annotated API for bindings; accordingly to bug #738176 comment #3, the current bindings' users are expected to pass null.
2017-09-11GSubprocessLauncher: add (transfer none) annotationAlberto Ruiz
https://bugzilla.gnome.org/show_bug.cgi?id=753521
2017-05-31gsubprocess: Copy parent process’ environ when clearing subprocess’Philip Withnall
Previously, this was done at the time of spawning the subprocess, which meant the g_subprocess_launcher_*_environ() functions could not be used to modify the parent process’ environment. Change the code to copy the parent process’ environment when g_subprocess_launcher_set_environ(NULL) is called. Document the change and add a unit test. https://bugzilla.gnome.org/show_bug.cgi?id=778422
2017-05-29gio/: LGPLv2+ -> LGPLv2.1+Sébastien Wilmet
Sub-directories inside gio/ already processed in a previous commit: - fam/ - gdbus-2.0/ (which contains only codegen/) - gvdb/ - inotify/ - tests/ - win32/ - xdgmime/ Other sub-directories inside gio/: - completion/: no license headers - kqueue/: not LGPL, BSD-style license https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-04-10Drop trailing semi-colon from G_DEFINE_ macroEmmanuele Bassi
It's unnecessary, and only adds visual noise; we have been fairly inconsistent in the past, but the semi-colon-less version clearly dominates in the code base. https://bugzilla.gnome.org/show_bug.cgi?id=669355
2017-02-13gsubprocesslauncher: Clarify the behavior of set_environ()Matthew Leeds
GNOME Builder's code was assuming that setting the launcher's environ to NULL makes the subprocess have an empty environment, but in fact the parent process's variables are still inherited because execv is used instead of execve when envp is NULL. This commit clarifies the documentation to make the behavior clear. https://bugzilla.gnome.org/show_bug.cgi?id=778422
2017-01-03subprocess: avoid infinite loop in verify_disposition()Christian Hergert
When performing the verify and building the error string there were two possibilities of an infinite loop. The first is the missing twos-complement to unset the bit in the filtered flags. The second is the lack of handling G_SUBPROCESS_FLAGS_NONE which can return a valid GFlagsValue (and cannot unset the bit since the value is zero). This walks all known values in the GSubprocessFlags type class and check if they are set. This has the benefit that we don't call needless functions which walk the same table as well as avoiding mutating values to build the error string. https://bugzilla.gnome.org/show_bug.cgi?id=775913
2016-09-12gsubprocess: Fix annotation for set_environ()Rico Tzschichholz
2016-06-07Partly revert "gio: Add filename type annotations"Christoph Reiter
Revert all annotation changes for environment variables and command line arguments. See commit f8189ddf9869ed8e90f9b640d9545fe4011adb7d.
2016-06-04gio: Add filename type annotationsChristoph Reiter
https://bugzilla.gnome.org/show_bug.cgi?id=767245
2015-06-05glib/genviron.c, GSubprocessLauncher: ain't no "filename encoding"Mikhail Zabaluev
Removed all mentions of GLib file name encoding referring to the environment strings. The env var content has no defined relation to GLib's notion of filename encoding, or any encoding whatsoever. It would be wrong to pass all UTF-8 strings through g_filename_from_utf8() in order to put them into the environment, for one thing. https://bugzilla.gnome.org/show_bug.cgi?id=738185
2014-06-29doc: various improvementsSébastien Wilmet
- g_subprocess_launcher_spawn() and spawnv(): there is no other way AFAIK to create a GSubprocess from a launcher. So these functions are not "convenience helper". - annotate optional arguments for g_shell_parse_argv(). - other trivial fix https://bugzilla.gnome.org/show_bug.cgi?id=732357
2014-05-20gsubprocess: Add a missing va_end() callPhilip Withnall
Coverity issues: #1214070, #1214069 https://bugzilla.gnome.org/show_bug.cgi?id=730278
2014-03-04GSubprocessLauncher: don't get empty environmentRyan Lortie
Use g_get_environ() to get the environment variables with their values instead of g_listenv() which only lists off the keys. https://bugzilla.gnome.org/show_bug.cgi?id=725651
2014-01-07Add includes to all gio docsMatthias Clasen
2013-12-26gsubprocesslauncher: Use "env" instead of "environ"Morten Welinder
The latter may come from system headers. https://bugzilla.gnome.org/show_bug.cgi?id=721059
2013-12-15gsubprocesslauncher: Annotate g_subprocess_launcher_spawnv()Colin Walters
Needs to be an array.
2013-11-28Fix g_subprocess_launcher_spawnMatthias Clasen
This function turns a varargs argument list into a string array, but forgets to NULL-terminate it. This function was not covered by unit tests...so it was broken.
2013-10-21GSubprocess win32 fixupsRyan Lortie
Note: we go out of our way not to pass a child setup function on win32 (even if it does nothing) because we get a g_warning() from gspawn if we do so.
2013-10-17Fix up subprocess docsMatthias Clasen
The GSubprocessLauncher docs had their own long description, but were not properly set up as their own section.
2013-10-17Fixup GSubprocess documentation bitsRyan Lortie
2013-10-17gsubprocess: Fix up communicateColin Walters
We weren't closing the streams after we were done reading or writing, which is kind of essential. The easy way to fix this is to just use g_output_stream_splice() to a GMemoryOutputStream rather than hand-rolling it. This results in a substantial reduction of code complexity. A second serious issue is that we were marking the task as complete when the process exits, but that's racy - there could still be data to read from stdout. Fix this by just refcounting outstanding operations. This code, not surprisingly, looks a lot like the "multi" test. Next, because processes output binary data, I'd be forced to annotate the char*/length pairs as (array) (element-type uint8). But rather than doing that, it's *far* simpler to just use GBytes. We need a version of this that actually validates as UTF-8, that will be in the next patch.
2013-10-17GSubprocess: New class for spawning child processesColin Walters
There are a number of nice things this class brings: 0) Has a race-free termination API on all platforms (on UNIX, calls to kill() and waitpid() are coordinated as not to cause problems). 1) Operates in terms of G{Input,Output}Stream, not file descriptors 2) Standard GIO-style async API for wait() with cancellation 3) Makes some simple cases easy, like synchronously spawning a process with an argument list 4) Makes hard cases possible, like asynchronously running a process with stdout/stderr merged, output directly to a file path Much rewriting and code review from Ryan Lortie <desrt@desrt.ca> https://bugzilla.gnome.org/show_bug.cgi?id=672102