summaryrefslogtreecommitdiff
path: root/src/io/line_test.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-02-04 23:18:54 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-02-06 11:18:37 -0800
commit9215c35975be745628e8188473154c7e476add55 (patch)
tree14d4f5d51381f8a59803233c24dfafc846ddf583 /src/io/line_test.cpp
parent9544985ccbb20d7f8377c63a4e59d1ff97b844ac (diff)
downloadtmwa-9215c35975be745628e8188473154c7e476add55.tar.gz
tmwa-9215c35975be745628e8188473154c7e476add55.tar.bz2
tmwa-9215c35975be745628e8188473154c7e476add55.tar.xz
tmwa-9215c35975be745628e8188473154c7e476add55.zip
Wrap remaining FDs in a class
Diffstat (limited to 'src/io/line_test.cpp')
-rw-r--r--src/io/line_test.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/io/line_test.cpp b/src/io/line_test.cpp
index 8df6bbc..ae316c6 100644
--- a/src/io/line_test.cpp
+++ b/src/io/line_test.cpp
@@ -5,19 +5,19 @@
#include "../strings/zstring.hpp"
static
-int string_pipe(ZString sz)
+io::FD string_pipe(ZString sz)
{
- int pfd[2];
- if (-1 == pipe(pfd))
- return -1;
- if (sz.size() != write(pfd[1], sz.c_str(), sz.size()))
+ io::FD rfd, wfd;
+ if (-1 == io::FD::pipe(rfd, wfd))
+ return io::FD();
+ if (sz.size() != wfd.write(sz.c_str(), sz.size()))
{
- close(pfd[0]);
- close(pfd[1]);
- return -1;
+ rfd.close();
+ wfd.close();
+ return io::FD();
}
- close(pfd[1]);
- return pfd[0];
+ wfd.close();
+ return rfd;
}
TEST(io, line1)