diff options
Diffstat (limited to 'bdep/git.ixx')
-rw-r--r-- | bdep/git.ixx | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/bdep/git.ixx b/bdep/git.ixx index e71375a..9369564 100644 --- a/bdep/git.ixx +++ b/bdep/git.ixx @@ -2,43 +2,31 @@ // copyright : Copyright (c) 2014-2018 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -using namespace butl; - namespace bdep { - template <typename... A> - inline void - run_git (const dir_path& repo, A&&... args) + template <typename I, typename O, typename E, typename... A> + inline process + start_git (const dir_path& repo, I&& in, O&& out, E&& err, A&&... args) { - return run ("git", "-C", repo, forward<A> (args)...); + return start_git (forward<I> (in), + forward<O> (out), + forward<E> (err), + "-C", repo, + forward<A> (args)...); } - template <typename I, typename O, typename E, typename... A> - inline process - start_git (I&& in, O&& out, E&& err, const dir_path& repo, A&&... args) + inline void + finish_git (process& pr, bool io_read) { - return start (forward<I> (in), - forward<O> (out), - forward<E> (err), - "git", - "-C", repo, - forward<A> (args)...); + finish ("git", pr, io_read); } template <typename... A> inline optional<string> git_line (const dir_path& repo, bool ie, A&&... args) { - fdpipe pipe (fdopen_pipe ()); - auto_fd null (ie ? fdnull () : auto_fd ()); - - process pr (start (0 /* stdin */, - pipe /* stdout */, - ie ? null.get () : 2 /* stderr */, - "git", - "-C", repo, - forward<A> (args)...)); - - return git_line (move (pr), move (pipe), ie); + return git_line (ie, + "-C", repo, + forward<A> (args)...); } } |