Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
p-groarke committed Mar 23, 2024
1 parent 496339b commit 76e749f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion include_cpp14/fea/terminal/pipe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ size_t available_pipe_bytes() {
} break;
}
#else
ioctl(fileno(stdin), FIONREAD, &ret);
int n = 0;
if (ioctl(fileno(stdin), FIONREAD, &n) != 0) {
fea::maybe_throw_on_errno(__FUNCTION__, __LINE__);
}
ret = size_t(n);
#endif

return ret;
Expand Down
7 changes: 6 additions & 1 deletion tests_pipe/terminal/pipe.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <fea/terminal/pipe.hpp>
#include <chrono>
#include <fea/terminal/pipe.hpp>
#include <gtest/gtest.h>
#include <string>
#include <thread>

extern int test_num;

Expand All @@ -9,6 +11,9 @@ const std::string expected = "l1 🙂\nl2\n<>\né\n";
const std::wstring wexpected = L"l1 🙂\nl2\n<>\né\n";

TEST(pipe, basics) {
// Are we too quick?
std::this_thread::sleep_for(std::chrono::milliseconds(100));

switch (test_num) {
case 0: {
std::string str = fea::read_pipe_text();
Expand Down

0 comments on commit 76e749f

Please sign in to comment.