summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2023-08-17 14:59:28 +0100
committerPhilip Withnall <philip@tecnocode.co.uk>2023-08-17 14:59:28 +0100
commit15022cab15c36ef2a54b7ac3f96e6ccdc751ac0d (patch)
treecaf9108e95958a469436e610c6e5143d68e1661d
parent77a56b58edfba5ac1c3375a6cc8e11747c7d1f75 (diff)
downloadglib-15022cab15c36ef2a54b7ac3f96e6ccdc751ac0d.tar.gz
gtestutils: Mention not ignoring SIGCHLD in g_test_trap_subprocess() docs
Prompted by #3071, this clarifies that `g_test_trap_subprocess()` uses `g_child_watch_source_new()` internally, so it will not work if any of the preconditions for using that API are not met. In particular, if `SIGCHLD` is ignored, things will break. This documentation is not meant to be an API guarantee which constrains the implementation of `g_test_trap_subprocess()` in future, just a tip to people currently using the API. Signed-off-by: Philip Withnall <philip@tecnocode.co.uk> Helps: #3071
-rw-r--r--glib/gtestutils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 70cdc20e0..483275a0a 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -4067,6 +4067,11 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* the subprocess, you can call g_test_subprocess() (after calling
* g_test_init()) to see whether you are in a subprocess.
*
+ * Internally, this function tracks the child process using
+ * g_child_watch_source_new(), so your process must not ignore `SIGCHLD`, and
+ * must not attempt to watch or wait for the child process via another
+ * mechanism.
+ *
* The following example tests that calling
* `my_object_new(1000000)` will abort with an error
* message.