From d933699b4dd106c227f8d07a2471d5f39f1c82af Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 3 Nov 2016 00:49:14 +0300 Subject: Adopt to auto_fd introduced to libbutl fdstreams and process --- build2/test/script/builtin | 2 +- build2/test/script/builtin.cxx | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) (limited to 'build2/test') 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 { 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; -- cgit v1.1