aboutsummaryrefslogtreecommitdiff
path: root/build2/test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-11-03 00:49:14 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:37 +0200
commitd933699b4dd106c227f8d07a2471d5f39f1c82af (patch)
tree4f6c6f962b4d0aaf7c5439d440f6376ebbb7deb0 /build2/test
parente4feb8be8bc8667b62574da521cd53ebc94b4afc (diff)
Adopt to auto_fd introduced to libbutl fdstreams and process
Diffstat (limited to 'build2/test')
-rw-r--r--build2/test/script/builtin2
-rw-r--r--build2/test/script/builtin.cxx17
2 files changed, 4 insertions, 15 deletions
diff --git a/build2/test/script/builtin b/build2/test/script/builtin
index 805e5fd..3e49f98 100644
--- a/build2/test/script/builtin
+++ b/build2/test/script/builtin
@@ -19,7 +19,7 @@ namespace build2
// Note that unlike argc/argv, our args don't include the program name.
//
using builtin = int (*) (const strings& args,
- int in_fd, int out_fd, int err_fd);
+ auto_fd in, auto_fd out, auto_fd err);
class builtin_map: public std::map<string, builtin>
{
diff --git a/build2/test/script/builtin.cxx b/build2/test/script/builtin.cxx
index f3a0bd4..a83bb6d 100644
--- a/build2/test/script/builtin.cxx
+++ b/build2/test/script/builtin.cxx
@@ -11,27 +11,16 @@ using namespace butl;
namespace build2
{
- //@@ auto_fd handover
- //
- // 1. We need auto_fd in libbutl
- // 2. Overload fdstream ctors for auto_fd&& (or replace? also process data
- // members?)
- // 3. The builtin signature then will become:
- //
- // static int
- // echo (const strings& args, auto_fd in, auto_fd out, auto_fd err)
-
static int
- echo (const strings& args, int in_fd, int out_fd, int err_fd)
+ echo (const strings& args, auto_fd, auto_fd out, auto_fd err)
try
{
int r (0);
- ofdstream cerr (err_fd);
+ ofdstream cerr (move (err));
try
{
- fdclose (in_fd); //@@ TMP
- ofdstream cout (out_fd);
+ ofdstream cout (move (out));
for (auto b (args.begin ()), i (b), e (args.end ()); i != e; ++i)
cout << (i != b ? " " : "") << *i;