Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a convenience 'call' overload #83

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion subprocess.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -2050,6 +2050,11 @@ int call(const std::string& arg, Args&&... args)
return (detail::call_impl(arg, std::forward<Args>(args)...));
}

template <typename... Args>
int call(std::vector<std::string> plist, Args &&... args)
{
return (detail::call_impl(plist, std::forward<Args>(args)...));
}

/*!
* Run the command with arguments and wait for it to complete.
Expand Down