aboutsummaryrefslogtreecommitdiff
path: root/libbutl/process.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-04-20 11:01:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-04-20 11:01:04 +0200
commit5389747f4fff27f85404c96ae969c0c1c7924d76 (patch)
tree1bb521763a40bcfcc069b776eae3d0e95a5f8746 /libbutl/process.cxx
parente9cf760289b47767fdacc6a98fb2040d35a63d49 (diff)
Add butl::move_only_function[_ex] similar to C++23 std::move_only_function
Diffstat (limited to 'libbutl/process.cxx')
-rw-r--r--libbutl/process.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/libbutl/process.cxx b/libbutl/process.cxx
index 5d7710e..5523b96 100644
--- a/libbutl/process.cxx
+++ b/libbutl/process.cxx
@@ -635,6 +635,10 @@ namespace butl
{
// Child.
//
+ // NOTE: make sure not to call anything that may acquire a mutex that
+ // could be already acquired in another thread, most notably
+ // malloc(). @@ What about exceptions (all the fail() calls)?
+
// Duplicate the user-supplied (fd > -1) or the created pipe descriptor
// to the standard stream descriptor (read end for STDIN_FILENO, write
// end otherwise). Close the pipe afterwards.
@@ -694,6 +698,9 @@ namespace butl
try
{
+ // @@ TODO: redo without allocation (PATH_MAX?) Maybe
+ // also using C API to avoid exceptions.
+ //
if (e != nullptr)
setenv (string (v, e - v), e + 1);
else
@@ -701,6 +708,8 @@ namespace butl
}
catch (const system_error& e)
{
+ // @@ Should we assume this cannot throw?
+ //
throw process_child_error (e.code ().value ());
}
}