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 <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
RaisinTen authored and ruyadorno committed Jan 21, 2021
1 parent e285a7a commit 3d20415
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 3d20415

Please sign in to comment.