diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-07-27 18:00:16 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-07-27 18:00:16 +0300 |
commit | 822059e4e69547f8e97a1cd219912f55826b0414 (patch) | |
tree | dc99f504046fb96b5cc3b1189c3d4107c03f96b7 | |
parent | 40426fe405dc795668351cb41bd50d8d08e5b094 (diff) |
Rename process_start() and process_run() overloads
-rw-r--r-- | libbutl/curl.hxx | 3 | ||||
-rw-r--r-- | libbutl/curl.txx | 2 | ||||
-rw-r--r-- | libbutl/openssl.hxx | 3 | ||||
-rw-r--r-- | libbutl/openssl.txx | 18 | ||||
-rw-r--r-- | libbutl/process-run.txx | 60 | ||||
-rw-r--r-- | libbutl/process.hxx | 26 | ||||
-rw-r--r-- | libbutl/sendmail.hxx | 3 | ||||
-rw-r--r-- | libbutl/sendmail.ixx | 16 | ||||
-rw-r--r-- | tests/process-run/driver.cxx | 16 | ||||
-rw-r--r-- | tests/progress/driver.cxx | 10 |
10 files changed, 82 insertions, 75 deletions
diff --git a/libbutl/curl.hxx b/libbutl/curl.hxx index 19105ef..dad0bf5 100644 --- a/libbutl/curl.hxx +++ b/libbutl/curl.hxx @@ -105,7 +105,8 @@ namespace butl const std::string& url, A&&... options); - // Version with the command line callback (see process_run() for details). + // Version with the command line callback (see process_run_callback() for + // details). // template <typename C, typename I, diff --git a/libbutl/curl.txx b/libbutl/curl.txx index fb48418..0c5fb2f 100644 --- a/libbutl/curl.txx +++ b/libbutl/curl.txx @@ -79,7 +79,7 @@ namespace butl io_data out_data; process& p (*this); - p = process_start ( + p = process_start_callback ( cmdc, map_in (std::forward<I> (in), mp, in_data), map_out (std::forward<O> (out), mp, out_data), diff --git a/libbutl/openssl.hxx b/libbutl/openssl.hxx index bd562d6..9ab248c 100644 --- a/libbutl/openssl.hxx +++ b/libbutl/openssl.hxx @@ -96,7 +96,8 @@ namespace butl const std::string& command, A&&... options); - // Version with the command line callback (see process_run() for details). + // Version with the command line callback (see process_run_callback() for + // details). // template <typename C, typename I, diff --git a/libbutl/openssl.txx b/libbutl/openssl.txx index 0a1788f..dd8a470 100644 --- a/libbutl/openssl.txx +++ b/libbutl/openssl.txx @@ -38,15 +38,15 @@ namespace butl io_data out_data; process& p (*this); - p = process_start (cmdc, - map_in (std::forward<I> (in), in_data), - map_out (std::forward<O> (out), out_data), - std::forward<E> (err), - env, - command, - in_data.options, - out_data.options, - std::forward<A> (options)...); + p = process_start_callback (cmdc, + map_in (std::forward<I> (in), in_data), + map_out (std::forward<O> (out), out_data), + std::forward<E> (err), + env, + command, + in_data.options, + out_data.options, + std::forward<A> (options)...); // Note: leaving this scope closes any open ends of the pipes in io_data. } diff --git a/libbutl/process-run.txx b/libbutl/process-run.txx index a78b87a..a9c7e8b 100644 --- a/libbutl/process-run.txx +++ b/libbutl/process-run.txx @@ -108,12 +108,12 @@ namespace butl typename E, typename... A> inline process - process_start (const C& cmdc, - I&& in, - O&& out, - E&& err, - const process_env& env, - A&&... args) + process_start_callback (const C& cmdc, + I&& in, + O&& out, + E&& err, + const process_env& env, + A&&... args) { return process_start (std::index_sequence_for<A...> (), cmdc, @@ -135,12 +135,12 @@ namespace butl const process_env& env, A&&... args) { - return process_start ([] (const char* [], std::size_t) {}, - std::forward<I> (in), - std::forward<O> (out), - std::forward<E> (err), - env, - std::forward<A> (args)...); + return process_start_callback ([] (const char* [], std::size_t) {}, + std::forward<I> (in), + std::forward<O> (out), + std::forward<E> (err), + env, + std::forward<A> (args)...); } template <typename C, @@ -149,20 +149,20 @@ namespace butl typename E, typename... A> inline process_exit - process_run (const C& cmdc, - I&& in, - O&& out, - E&& err, - const process_env& env, - A&&... args) + process_run_callback (const C& cmdc, + I&& in, + O&& out, + E&& err, + const process_env& env, + A&&... args) { process pr ( - process_start (cmdc, - std::forward<I> (in), - std::forward<O> (out), - std::forward<E> (err), - env, - std::forward<A> (args)...)); + process_start_callback (cmdc, + std::forward<I> (in), + std::forward<O> (out), + std::forward<E> (err), + env, + std::forward<A> (args)...)); pr.wait (); return *pr.exit; @@ -179,11 +179,11 @@ namespace butl const process_env& env, A&&... args) { - return process_run ([] (const char* [], std::size_t) {}, - std::forward<I> (in), - std::forward<O> (out), - std::forward<E> (err), - env, - std::forward<A> (args)...); + return process_run_callback ([] (const char* [], std::size_t) {}, + std::forward<I> (in), + std::forward<O> (out), + std::forward<E> (err), + env, + std::forward<A> (args)...); } } diff --git a/libbutl/process.hxx b/libbutl/process.hxx index ee17207..cd692ca 100644 --- a/libbutl/process.hxx +++ b/libbutl/process.hxx @@ -397,7 +397,7 @@ namespace butl // read from /dev/null, stdout redirect to stderr, and inherit the parent's // stderr. // - // process_run (..., fdnull (), 2, 2, ...) + // process_run (fdnull (), 2, 2, ...) // // The P argument is the program path. It can be anything that can be passed // to process::path_search() (const char*, std::string, path) or the @@ -504,12 +504,12 @@ namespace butl typename E, typename... A> process_exit - process_run (const C&, - I&& in, - O&& out, - E&& err, - const process_env&, - A&&... args); + process_run_callback (const C&, + I&& in, + O&& out, + E&& err, + const process_env&, + A&&... args); // Versions that start the process without waiting. // @@ -530,12 +530,12 @@ namespace butl typename E, typename... A> process - process_start (const C&, - I&& in, - O&& out, - E&& err, - const process_env&, - A&&... args); + process_start_callback (const C&, + I&& in, + O&& out, + E&& err, + const process_env&, + A&&... args); // Conversion of types to their C string representations. Can be overloaded // (including via ADL) for custom types. The default implementation calls diff --git a/libbutl/sendmail.hxx b/libbutl/sendmail.hxx index 465a474..c631f18 100644 --- a/libbutl/sendmail.hxx +++ b/libbutl/sendmail.hxx @@ -77,7 +77,8 @@ namespace butl const recipients_type& bcc, O&&... options); - // Version with the command line callback (see process_run() for details). + // Version with the command line callback (see process_run_callback() for + // details). // template <typename C, typename E> sendmail (const C&, diff --git a/libbutl/sendmail.ixx b/libbutl/sendmail.ixx index 72d3d45..36c0530 100644 --- a/libbutl/sendmail.ixx +++ b/libbutl/sendmail.ixx @@ -62,14 +62,14 @@ namespace butl fdpipe pipe (fdopen_pipe ()); // Text mode seems appropriate. process& p (*this); - p = process_start (cmdc, - pipe.in, - 2, // No output expected so redirect to stderr. - std::forward<E> (err), - "sendmail", - "-i", // Don't treat '.' as the end of input. - "-t", // Read recipients from headers. - std::forward<O> (options)...); + p = process_start_callback (cmdc, + pipe.in, + 2, // No output expected so redirect to stderr. + std::forward<E> (err), + "sendmail", + "-i", // Don't treat '.' as the end of input. + "-t", // Read recipients from headers. + std::forward<O> (options)...); // Close the reading end of the pipe not to block on writing if sendmail // terminates before that. diff --git a/tests/process-run/driver.cxx b/tests/process-run/driver.cxx index ff9dd25..695fdb9 100644 --- a/tests/process-run/driver.cxx +++ b/tests/process-run/driver.cxx @@ -65,14 +65,14 @@ main (int argc, const char* argv[]) assert (run (0, 1, 2, p)); assert (run (0, 1, 2, p, "-c")); - process_run ([] (const char* c[], size_t n) - { - process::print (cout, c, n); - cout << endl; - }, - 0, 1, 2, - p, - "-c"); + process_run_callback ([] (const char* c[], size_t n) + { + process::print (cout, c, n); + cout << endl; + }, + 0, 1, 2, + p, + "-c"); // Stream conversion and redirection. // diff --git a/tests/progress/driver.cxx b/tests/progress/driver.cxx index 64e84fd..791e485 100644 --- a/tests/progress/driver.cxx +++ b/tests/progress/driver.cxx @@ -70,10 +70,14 @@ main (int argc, const char* argv[]) auto print = [] (const string& s) { #ifndef _WIN32 - write (stderr_fd(), s.c_str (), s.size ()); + ssize_t r (write (stderr_fd(), s.c_str (), s.size ())); #else - _write (stderr_fd(), s.c_str (), static_cast<unsigned int> (s.size ())); + int r (_write (stderr_fd(), + s.c_str (), + static_cast<unsigned int> (s.size ()))); #endif + + assert (r != -1); }; for (size_t i (50); i != 0; --i) @@ -89,7 +93,7 @@ main (int argc, const char* argv[]) // warns about calls ambiguity). // process pr (!no_child - ? process_start (fdnull (), fdnull (), stderr_fd (), + ? process_start (fdnull (), fdnull (), 2, process_env (argv[0]), "-c") : process (process_exit (0))); // Exited normally. |