[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 08/10: [grohtml]: Stop discarding standard error output.
From: |
G. Branden Robinson |
Subject: |
[groff] 08/10: [grohtml]: Stop discarding standard error output. |
Date: |
Mon, 26 Jul 2021 20:38:49 -0400 (EDT) |
gbranden pushed a commit to branch master
in repository groff.
commit 98367a8408b36eb04d564ff6a4f5617544c61ee0
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Jul 26 23:50:23 2021 +1000
[grohtml]: Stop discarding standard error output.
* src/preproc/html/pre-html.cpp (html_system): Stop sending the standard
error stream to /dev/null; this just makes debugging harder, and
doesn't produce much more output for well-formed input documents.
Rename `save_stdout` to `saved_stdout`.
---
ChangeLog | 9 +++++++++
src/preproc/html/pre-html.cpp | 16 ++++------------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 627a33a..8cb0ebf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2021-07-26 G. Branden Robinson <g.branden.robinson@gmail.com>
+ [grohtml]: Stop discarding standard error output.
+
+ * src/preproc/html/pre-html.cpp (html_system): Stop sending the
+ standard error stream to /dev/null; this just makes debugging
+ harder, and doesn't produce much more output for well-formed
+ input documents. Rename `save_stdout` to `saved_stdout`.
+
+2021-07-26 G. Branden Robinson <g.branden.robinson@gmail.com>
+
[grohtml]: Fix misspelled variable.
* src/preproc/html/pre-html.cpp: Rename `IMAGE_BOARDER_PIXELS`
diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index 84e5a32..4ff475c 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -324,28 +324,20 @@ void html_system(const char *s, int redirect_stdout)
}
#endif
{
- // Redirect standard error to the null device. This is more
- // portable than using "2> /dev/null", since it doesn't require a
- // Unixy shell.
- int save_stderr = dup(2);
- int save_stdout = dup(1);
+ int saved_stdout = dup(1);
int fdnull = open(NULL_DEV, O_WRONLY|O_BINARY, 0666);
- if (save_stderr > 2 && fdnull > 2)
- dup2(fdnull, 2);
- if (redirect_stdout && save_stdout > 1 && fdnull > 1)
+ if (redirect_stdout && saved_stdout > 1 && fdnull > 1)
dup2(fdnull, 1);
if (fdnull >= 0)
close(fdnull);
int status = system(s);
- dup2(save_stderr, 2);
if (redirect_stdout)
- dup2(save_stdout, 1);
+ dup2(saved_stdout, 1);
if (status == -1)
fprintf(stderr, "Calling '%s' failed\n", s);
else if (status)
fprintf(stderr, "Calling '%s' returned status %d\n", s, status);
- close(save_stderr);
- close(save_stdout);
+ close(saved_stdout);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 08/10: [grohtml]: Stop discarding standard error output.,
G. Branden Robinson <=