aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-02 20:30:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-02 20:30:04 -0700
commit351fd25cc88f689a672718662b9fc67d2aedeaf8 (patch)
tree0efc1064db6e6876301614a0d05c81a9b03194d4
parent0bf056a8902c223c1767c62bf7d9fdff4f83e9af (diff)
downloadpw-351fd25cc88f689a672718662b9fc67d2aedeaf8.tar.gz
pw-351fd25cc88f689a672718662b9fc67d2aedeaf8.tar.bz2
pw-351fd25cc88f689a672718662b9fc67d2aedeaf8.zip
Don't touch tty if exiting while backgrounded.
-rw-r--r--pw.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/pw.c b/pw.c
index d471286..2ef63a5 100644
--- a/pw.c
+++ b/pw.c
@@ -840,7 +840,8 @@ int main(int argc, char **argv)
if (!ferror(stdin))
exit_status = 0;
if (auto_quit) {
- clrline();
+ if ((stat & stat_bkgnd) == 0)
+ clrline();
break;
}
}
@@ -1348,7 +1349,11 @@ int main(int argc, char **argv)
}
}
}
- clrline();
- ttyset(ttyfd, &tty_saved);
+
+ if ((stat & stat_bkgnd) == 0) {
+ clrline();
+ ttyset(ttyfd, &tty_saved);
+ }
+
return exit_status;
}