2017-11-06 17:31 GMT+01:00 <philippe.houdoin@xxxxxxxxx>:
hrev51525 adds 1 changeset to branch 'master'
old head: 2d27c2d003a154f7ad375446e2c6dd291cf97018
new head: 33d4c8a62e32344e9207536e8f72d0f23b0fc0ee
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=33d4c8a62e32+%5E2d27c2d003a1
@@ -865,12 +865,14 @@ GrepWindow::_OnNodeMonitorEvent(BMessage* message)
if (entry.GetRef(&ref) == B_OK) {
int32 index;
ResultItem* item =
fSearchResults->FindItem(ref, &index);
- item->SetText(path.String());
- // take care of invalidation, the
index is currently
- // the full list index, but needs to
be the visible
- // items index for this
- index = fSearchResults->IndexOf(item);
- fSearchResults->InvalidateItem(index);
+ if (item) {
+ item->SetText(path.String());
+ // take care of invalidation,
the index is currently
+ // the full list index, but
needs to be the visible
+ // items index for this
+ index =
fSearchResults->IndexOf(item);
+
fSearchResults->InvalidateItem(index);
+ }
}
}
break;
diff --git a/src/apps/text_search/Grepper.cpp
b/src/apps/text_search/Grepper.cpp
index 1a40dec..175634a 100644
--- a/src/apps/text_search/Grepper.cpp
+++ b/src/apps/text_search/Grepper.cpp
@@ -10,6 +10,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/select.h>
+#include <errno.h>
+
+#include <OS.h>
+#include <image.h>
#include <Catalog.h>
#include <Directory.h>
+ // prepare xargs to run with stdin, stdout and stderr pipes
+
+ int oldStdIn, oldStdOut, oldStdErr;
+ oldStdIn = dup(STDIN_FILENO);
+ oldStdOut = dup(STDOUT_FILENO);
+ oldStdErr = dup(STDERR_FILENO);
+
+ int fds[2];
+ pipe(fds); dup2(fds[0], STDIN_FILENO); close(fds[0]);
+ fXargsInput = fds[1]; // write to in, appears on command's stdin
+
+ pipe(fds); dup2(fds[1], STDOUT_FILENO); close(fds[1]);
+ int out = fds[0]; // read from out, taken from command's stdout
+
+ pipe(fds);dup2(fds[1], STDERR_FILENO); close(fds[1]);
+ int err = fds[0]; // read from err, taken from command's stderr
+
+ // "load" command
+ thread_id xargsThread = load_image(argc, argv,
+ const_cast<const char**>(environ));
+ // xargsThread is suspended after loading
+
+ // restore our previous stdin, stdout and stderr
+ close(STDIN_FILENO); dup(oldStdIn); close(oldStdIn);
+ close(STDOUT_FILENO); dup(oldStdOut); close(oldStdOut);
+ close(STDERR_FILENO); dup(oldStdErr); close(oldStdErr);