aboutsummaryrefslogtreecommitdiff
path: root/bpkg/utility.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-01-10 23:33:31 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-01-12 13:07:30 +0300
commit01c179eed3fcfccc7cdd262742935177dfcf5106 (patch)
treeb6044897e1e752d5454f6144618ef8d46d661438 /bpkg/utility.cxx
parent14d987674aa01cfc41f7cda4932cb5808b3ef738 (diff)
Assume git repository protocol as smart if HTTP response code is 401
Diffstat (limited to 'bpkg/utility.cxx')
-rw-r--r--bpkg/utility.cxx19
1 files changed, 19 insertions, 0 deletions
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 ();
+ }
}