From 01c179eed3fcfccc7cdd262742935177dfcf5106 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 10 Jan 2023 23:33:31 +0300 Subject: Assume git repository protocol as smart if HTTP response code is 401 --- bpkg/utility.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bpkg/utility.cxx') diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx index 467e01f..52114df 100644 --- a/bpkg/utility.cxx +++ b/bpkg/utility.cxx @@ -366,4 +366,23 @@ namespace bpkg ? co.build ().string ().c_str () : BPKG_EXE_PREFIX "b" BPKG_EXE_SUFFIX; } + + void + dump_stderr (auto_fd&& fd) + { + ifdstream is (move (fd), fdstream_mode::skip, ifdstream::badbit); + + // We could probably write something like this, instead: + // + // *diag_stream << is.rdbuf () << flush; + // + // However, it would never throw and we could potentially miss the reading + // failure, unless we decide to additionally mess with the diagnostics + // stream exception mask. + // + for (string l; !eof (getline (is, l)); ) + *diag_stream << l << endl; + + is.close (); + } } -- cgit v1.1