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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 14 Nov 2019 22:49:12 +0000 (17:49 -0500)
commit8403432ffd92e7a5bd8967323e02df9ce2a34c98
tree63f0869f7d07cb96580f5166e0d0d7615df29982
parent24847fc77f9f6ccf2acc20141b4240a53903c08d
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.024901 seconds and 4 git commands to generate.