mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
logger: minor performance improvement to avoid syscall done by isatty
This commit is contained in:
parent
a5419ea670
commit
15bdab89c3
4 changed files with 4 additions and 4 deletions
|
|
@ -351,7 +351,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
if (linebuf)
|
||||
setlinebuf(this->file);
|
||||
|
||||
if (!isatty(fileno(this->file)) && !force_colors) {
|
||||
if (this->colors && !force_colors && !isatty(fileno(this->file)) ) {
|
||||
this->colors = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ int main(int argc, char *argv[])
|
|||
d.opt_prefix = NULL;
|
||||
d.opt_recurse = false;
|
||||
d.opt_newline = true;
|
||||
if (isatty(fileno(stdout)) && getenv("NO_COLOR") == NULL)
|
||||
if (getenv("NO_COLOR") == NULL && isatty(fileno(stdout)))
|
||||
d.opt_colors = true;
|
||||
d.opt_cmd = "paths";
|
||||
|
||||
|
|
|
|||
|
|
@ -1541,7 +1541,7 @@ int main(int argc, char *argv[])
|
|||
pw_init(&argc, &argv);
|
||||
|
||||
data.out = stdout;
|
||||
if (isatty(fileno(data.out)) && getenv("NO_COLOR") == NULL)
|
||||
if (getenv("NO_COLOR") == NULL && isatty(fileno(data.out)))
|
||||
colors = true;
|
||||
setlinebuf(data.out);
|
||||
|
||||
|
|
|
|||
|
|
@ -786,7 +786,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
setlinebuf(stdout);
|
||||
|
||||
if (isatty(STDOUT_FILENO) && getenv("NO_COLOR") == NULL)
|
||||
if (getenv("NO_COLOR") == NULL && isatty(STDOUT_FILENO))
|
||||
colors = true;
|
||||
|
||||
while ((c = getopt_long(argc, argv, "hVr:NCoa", long_options, NULL)) != -1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue