Merge pull request #4002 from orestisfl/DLOG_CHILD

i3bar: Add a macro to log child info
This commit is contained in:
Ingo Bürk 2020-04-10 13:59:55 +02:00 committed by GitHub
commit 1e6b510497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -32,6 +32,8 @@
/* Global variables for child_*() */
i3bar_child child;
#define DLOG_CHILD DLOG("%s: pid=%ld stopped=%d stop_signal=%d cont_signal=%d click_events=%d click_events_init=%d\n", \
__func__, (long)child.pid, child.stopped, child.stop_signal, child.cont_signal, child.click_events, child.click_events_init)
/* stdin- and SIGCHLD-watchers */
ev_io *stdin_io;
@ -604,9 +606,12 @@ void start_child(char *command) {
ev_child_start(main_loop, child_sig);
atexit(kill_child_at_exit);
DLOG_CHILD;
}
static void child_click_events_initialize(void) {
DLOG_CHILD;
if (!child.click_events_init) {
yajl_gen_array_open(gen);
child_write_output();
@ -685,6 +690,8 @@ void send_block_clicked(int button, const char *name, const char *instance, int
*
*/
void kill_child_at_exit(void) {
DLOG_CHILD;
if (child.pid > 0) {
if (child.cont_signal > 0 && child.stopped)
killpg(child.pid, child.cont_signal);
@ -698,6 +705,8 @@ void kill_child_at_exit(void) {
*
*/
void kill_child(void) {
DLOG_CHILD;
if (child.pid > 0) {
if (child.cont_signal > 0 && child.stopped)
killpg(child.pid, child.cont_signal);
@ -713,6 +722,8 @@ void kill_child(void) {
*
*/
void stop_child(void) {
DLOG_CHILD;
if (child.stop_signal > 0 && !child.stopped) {
child.stopped = true;
killpg(child.pid, child.stop_signal);
@ -724,6 +735,8 @@ void stop_child(void) {
*
*/
void cont_child(void) {
DLOG_CHILD;
if (child.cont_signal > 0 && child.stopped) {
child.stopped = false;
killpg(child.pid, child.cont_signal);