mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-05 12:56:23 -04:00
Added debug code
This commit is contained in:
parent
6817d92533
commit
169bde5c08
6
main.cc
6
main.cc
@ -9,8 +9,10 @@ int main() {
|
|||||||
auto buf = check_output({"echo", "\"It works!\""});
|
auto buf = check_output({"echo", "\"It works!\""});
|
||||||
std::cout << buf.buf.data() << " :: " << buf.length << std::endl;
|
std::cout << buf.buf.data() << " :: " << buf.length << std::endl;
|
||||||
|
|
||||||
auto buf2 = check_output("cat subprocess.hpp");
|
buf = check_output("cat subprocess.hpp");
|
||||||
std::cout << buf2.buf.data() << " :: " << buf2.length << std::endl;
|
//std::cout << buf2.buf.data() << " :: " << buf2.length << std::endl;
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -279,6 +279,22 @@ public:
|
|||||||
Buffer(size_t cap) { buf.resize(cap); }
|
Buffer(size_t cap) { buf.resize(cap); }
|
||||||
void add_cap(size_t cap) { buf.resize(cap); }
|
void add_cap(size_t cap) { buf.resize(cap); }
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
Buffer(const Buffer& other):
|
||||||
|
buf(other.buf),
|
||||||
|
length(other.length)
|
||||||
|
{
|
||||||
|
std::cout << "COPY" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Buffer(Buffer&& other):
|
||||||
|
buf(std::move(other.buf)),
|
||||||
|
length(other.length)
|
||||||
|
{
|
||||||
|
std::cout << "MOVE" << std::endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector<char> buf;
|
std::vector<char> buf;
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
@ -1007,7 +1023,7 @@ namespace detail
|
|||||||
if (retcode) {
|
if (retcode) {
|
||||||
throw CalledProcessError("Command failed");
|
throw CalledProcessError("Command failed");
|
||||||
}
|
}
|
||||||
return (res.first);
|
return std::move(res.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1021,13 +1037,13 @@ int call(Args&&... args)
|
|||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
OutBuffer check_output(std::initializer_list<const char*> plist, Args&&... args)
|
OutBuffer check_output(std::initializer_list<const char*> plist, Args&&... args)
|
||||||
{
|
{
|
||||||
return detail::check_output_impl(plist, std::forward<Args>(args)...);
|
return (detail::check_output_impl(plist, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
OutBuffer check_output(const std::string& arg, Args&&... args)
|
OutBuffer check_output(const std::string& arg, Args&&... args)
|
||||||
{
|
{
|
||||||
return detail::check_output_impl(arg, std::forward<Args>(args)...);
|
return (detail::check_output_impl(arg, std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user