commit f3237dd1f92945e8adfb89cc124d41b3d16d99f5
parent 494b7acad7b09b0dadcc5a7241920e1f9a41916a
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Tue, 29 Jun 2021 22:32:27 -0700
Add a failure state to the player
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/aps/player.c b/aps/player.c
@@ -115,7 +115,9 @@ void
pupdate(struct player *p, int status)
{
if (WIFEXITED(status) || WIFSIGNALED(status)) {
- if (p->state != STOPPED)
+ if (WIFEXITED(status) && p->state != STOPPED)
+ p->state = WEXITSTATUS(status) ? FAILURE : 0;
+ else
p->state = 0;
} else if (WIFCONTINUED(status)) {
p->state = RUNNING;
diff --git a/aps/player.h b/aps/player.h
@@ -1,7 +1,8 @@
enum player_state {
RUNNING = 1,
STOPPED = 2,
- SUSPENDED = 4
+ SUSPENDED = 4,
+ FAILURE = 8
};
struct player {