From 9efaec26d23fa8eb787d025f6d4207f651d86cd5 Mon Sep 17 00:00:00 2001 From: TheMarpe Date: Wed, 8 Feb 2023 13:06:44 +0200 Subject: [PATCH 1/3] Added an option to build tests that defaults to off --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39951e4..966a6af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,10 @@ project(subprocess CXX) set(CMAKE_CXX_STANDARD 11) +# Options +option(BUILD_TESTING "Build tests" OFF) + +# Tests include(CTest) if(BUILD_TESTING) add_subdirectory(test) From 6786599ec12f8f3fd694059035063a9a0f134fa8 Mon Sep 17 00:00:00 2001 From: TheMarpe Date: Wed, 8 Feb 2023 13:06:55 +0200 Subject: [PATCH 2/3] Fixed a typo in README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a27e68c..199f9c1 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ and they will be fixed as they are reported. Subprocess library has just a single source `subprocess.hpp` present at the top directory of this repository. All you need to do is add ```cpp -#inlcude "cpp-subprocess/subprocess.hpp" +#include "cpp-subprocess/subprocess.hpp" using namespace subprocess; // OR -// namespace sp = subprocess; +// namespace sp = subprocess; // Or give any other alias you like. ``` to the files where you want to make use of subprocessing. Make sure to add necessary switches to add C++11 support (-std=c++11 in g++ and clang). @@ -35,7 +35,7 @@ Checkout http://templated-thoughts.blogspot.in/2016/03/sub-processing-with-moder ## Compiler Support Linux - g++ 4.8 and above -Mac OS - Clang 3.4 and later +Mac OS - Clang 3.4 and later Windows - MSVC 2015 and above ## Examples From c72b234cae060f03fc723accc4c6361925faa6e5 Mon Sep 17 00:00:00 2001 From: TheMarpe Date: Wed, 8 Feb 2023 13:07:25 +0200 Subject: [PATCH 3/3] Added a 'call' convenience overload --- subprocess.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subprocess.hpp b/subprocess.hpp index aaed3c7..971a50e 100755 --- a/subprocess.hpp +++ b/subprocess.hpp @@ -786,7 +786,7 @@ struct input } explicit input(IOTYPE typ) { assert (typ == PIPE && "STDOUT/STDERR not allowed"); -#ifndef __USING_WINDOWS__ +#ifndef __USING_WINDOWS__ std::tie(rd_ch_, wr_ch_) = util::pipe_cloexec(); #endif } @@ -2050,6 +2050,11 @@ int call(const std::string& arg, Args&&... args) return (detail::call_impl(arg, std::forward(args)...)); } +template +int call(std::vector plist, Args &&... args) +{ + return (detail::call_impl(plist, std::forward(args)...)); +} /*! * Run the command with arguments and wait for it to complete.