fix(script): do not hide failing scripts with constant output

This commit is contained in:
indev 2022-04-02 01:15:35 +07:00 committed by Patrick Ziegler
parent ff6ac9fefc
commit 36d19d372d
2 changed files with 3 additions and 7 deletions

View File

@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Breaking
- `custom/script` now doesn't hide failing script if it's output is not changing ([`#2636`](https://github.com/polybar/polybar/issues/2636)). Somewhat similar behaviour can be imitated with `format-fail`, if necessary.
## [3.6.1] - 2022-03-05 ## [3.6.1] - 2022-03-05
### Build ### Build

View File

@ -106,8 +106,6 @@ script_runner::interval script_runner::run() {
int fd = cmd.get_stdout(PIPE_READ); int fd = cmd.get_stdout(PIPE_READ);
assert(fd != -1); assert(fd != -1);
bool changed = false;
bool got_output = false; bool got_output = false;
while (!m_stopping && cmd.is_running() && !io_util::poll(fd, POLLHUP, 0)) { while (!m_stopping && cmd.is_running() && !io_util::poll(fd, POLLHUP, 0)) {
/** /**
@ -115,7 +113,7 @@ script_runner::interval script_runner::run() {
* down, we still need to continue polling. * down, we still need to continue polling.
*/ */
if (io_util::poll_read(fd, 25) && !got_output) { if (io_util::poll_read(fd, 25) && !got_output) {
changed = set_output(cmd.readline()); set_output(cmd.readline());
got_output = true; got_output = true;
} }
} }
@ -127,10 +125,6 @@ script_runner::interval script_runner::run() {
m_exit_status = cmd.wait(); m_exit_status = cmd.wait();
if (!changed && m_exit_status != 0) {
clear_output();
}
if (m_exit_status == 0) { if (m_exit_status == 0) {
return m_interval_success; return m_interval_success;
} else { } else {