Skip to content

Commit

Permalink
test: fix warning in test_environment.cc
Browse files Browse the repository at this point in the history
```
warning log:
../test/cctest/test_environment.cc: In constructor   \
‘RedirectStdErr::RedirectStdErr(const char*)’:
../test/cctest/test_environment.cc:77:12: warning:   \
ignoring return value of ‘FILE* freopen(const char*, \
const char*, FILE*)’, declared with attribute
warn_unused_result [-Wunused-result]
     freopen(filename_, "w", stderr);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
```

PR-URL: #36846
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
RaisinTen authored and targos committed May 1, 2021
1 parent b25b694 commit 90122d8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/cctest/test_environment.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "node_buffer.h"
#include "node_internals.h"
#include "libplatform/libplatform.h"
#include "util.h"

#include <string>
#include "gtest/gtest.h"
Expand All @@ -10,6 +11,7 @@

using node::AtExit;
using node::RunAtExit;
using node::USE;

static bool called_cb_1 = false;
static bool called_cb_2 = false;
Expand Down Expand Up @@ -74,7 +76,7 @@ class RedirectStdErr {
fflush(stderr);
fgetpos(stderr, &pos_);
fd_ = dup(fileno(stderr));
freopen(filename_, "w", stderr);
USE(freopen(filename_, "w", stderr));
}

~RedirectStdErr() {
Expand Down

0 comments on commit 90122d8

Please sign in to comment.