aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-15 17:42:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-15 17:42:10 +0200
commit0cb36399cc23f8efa83134cbca689b74478ee597 (patch)
tree6059646646eba93426063cef91aa4d673f200b26
parent7761021425f7b1884360a8be0b2d0d8965040f4e (diff)
Improve BLODA code
-rw-r--r--libbutl/process.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/libbutl/process.cxx b/libbutl/process.cxx
index 70f05b1..d5a35c0 100644
--- a/libbutl/process.cxx
+++ b/libbutl/process.cxx
@@ -1541,17 +1541,17 @@ namespace butl
DWORD r;
system_clock::duration twd (0); // Total wait time.
- // We will wait for non-whitelisted program indefinitely, until it
- // terminates or prints to stdout/stderr. Note that any MSYS program
- // that reads from stdin prior to writing to stdout/stderr must be
- // whitelisted.
+ // We wait for non-whitelisted programs indefinitely, until it
+ // terminates or prints to stdout/stderr. For whitelisted we wait
+ // for half a second. Any MSYS program that reads from stdin prior
+ // to writing to piped stdout/stderr must be whitelisted.
//
- const vector<path> wl ({path ("less.exe")});
+ const char* wl[] = {"less.exe"};
+ const char** wle = wl + sizeof (wl) / sizeof (wl[0]);
- bool w (find (wl.begin (), wl.end (), pp.effect.leaf ()) !=
- wl.end ());
+ bool w (find (wl, wle, pp.effect.leaf ().string ()) != wle);
- for (size_t n (0);;) // Wait n times by 100ms.
+ for (size_t n (0);; ++n) // Wait n times by 100ms.
{
// Hidden by butl::duration that is introduced via fdstream.mxx.
//
@@ -1563,7 +1563,7 @@ namespace butl
if (r != WAIT_TIMEOUT ||
probe_fd (in_ofd.in.get (), pout.in) ||
probe_fd (in_efd.in.get (), perr.in) ||
- (w && ++n == 5))
+ (w && n == 4))
break;
}