bt_common_abort(): optionally execute a custom command before aborting
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 2 Nov 2019 02:49:59 +0000 (22:49 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sun, 3 Nov 2019 15:34:34 +0000 (10:34 -0500)
commit59b3e31ded241ad159dbc618cc84a039f34f6e19
tree4106306f4424f7d91f996c500fa4f2d199c82fbb
parent498e7994d60bd0e9f63c3d5c0fd00eec77ba7c34
bt_common_abort(): optionally execute a custom command before aborting

This patch makes bt_common_abort() execute the value of the
`BABELTRACE_EXEC_ON_ABORT` environment variable, if it's set, as a shell
command line if the setuid/setgid flags are NOT set (for security).

The function uses g_spawn_command_line_sync() which claims to parse the
command line string like a UNIX 98 shell would, so that's what I wrote
in the environment variable's description in the manual page.

You can use this to execute any command when any part of the Babeltrace
project would abort, for example report it to some system.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I78801460b316f04d805162af320ee30028dc90de
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2318
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
doc/man/common-common-env.txt
src/common/common.c
This page took 0.025311 seconds and 4 git commands to generate.