Slightly simplify and document script executing
This commit is contained in:
parent
52134ab8ce
commit
bc3de38aa7
@ -129,6 +129,7 @@ void notification_run_script(struct notification *n)
|
|||||||
int status;
|
int status;
|
||||||
waitpid(pid1, &status, 0);
|
waitpid(pid1, &status, 0);
|
||||||
} else {
|
} else {
|
||||||
|
// second fork to prevent zombie processes
|
||||||
int pid2 = fork();
|
int pid2 = fork();
|
||||||
if (pid2) {
|
if (pid2) {
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -153,7 +154,7 @@ void notification_run_script(struct notification *n)
|
|||||||
safe_setenv("DUNST_TIMESTAMP", n_timestamp_str);
|
safe_setenv("DUNST_TIMESTAMP", n_timestamp_str);
|
||||||
safe_setenv("DUNST_STACK_TAG", n->stack_tag);
|
safe_setenv("DUNST_STACK_TAG", n->stack_tag);
|
||||||
|
|
||||||
int ret = execlp(script,
|
execlp(script,
|
||||||
script,
|
script,
|
||||||
appname,
|
appname,
|
||||||
summary,
|
summary,
|
||||||
@ -161,14 +162,13 @@ void notification_run_script(struct notification *n)
|
|||||||
icon,
|
icon,
|
||||||
urgency,
|
urgency,
|
||||||
(char *)NULL);
|
(char *)NULL);
|
||||||
if (ret != 0) {
|
|
||||||
LOG_W("Unable to run script %s: %s", n->scripts[i], strerror(errno));
|
LOG_W("Unable to run script %s: %s", n->scripts[i], strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper function to convert an urgency to a string
|
* Helper function to convert an urgency to a string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user