From 95ff8f359cfc2189bd4d7e02e15373027d2bda32 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 29 May 2017 20:05:54 +0300 Subject: Implement openssl process --- libbutl/openssl.txx | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 libbutl/openssl.txx (limited to 'libbutl/openssl.txx') diff --git a/libbutl/openssl.txx b/libbutl/openssl.txx new file mode 100644 index 0000000..aaaa239 --- /dev/null +++ b/libbutl/openssl.txx @@ -0,0 +1,56 @@ +// file : libbutl/openssl.txx -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include // move(), forward() + +namespace butl +{ + template + typename std::enable_if::value, I>::type openssl:: + map_in (I&& in, io_data&) + { + return std::forward (in); + } + + template + typename std::enable_if::value, O>::type openssl:: + map_out (O&& out, io_data&) + { + return std::forward (out); + } + + template + openssl:: + openssl (const C& cmdc, + I&& in, + O&& out, + E&& err, + const P& program, + const std::string& command, + A&&... options) + { + io_data in_data; + io_data out_data; + + process& p (*this); + p = process_start ( + cmdc, + map_in (std::forward (in), in_data), + map_out (std::forward (out), out_data), + std::forward (err), + dir_path (), + program, + command, + in_data.options, + out_data.options, + std::forward (options)...); + + // Note: leaving this scope closes any open ends of the pipes in io_data. + } +} -- cgit v1.1