PATCH: grep part

jbb jbb at kdevelop.org
Fri Dec 13 19:52:05 UTC 2002


Hi,

This minor problem annoys me, but is this a general issue with xargs on other 
platforms? I think it should be... This behaviour happens for me when 
searching for "slotStart" in kdevelop sources. (I'm running Mandrake 9.0)

I'll commit unless people object.

jbb

Index: parts/grepview/grepviewwidget.cpp
===================================================================
RCS file: /home/kde/kdevelop/parts/grepview/grepviewwidget.cpp,v
retrieving revision 1.9
diff -u -r1.9 grepviewwidget.cpp
--- parts/grepview/grepviewwidget.cpp	8 Dec 2002 16:59:10 -0000	1.9
+++ parts/grepview/grepviewwidget.cpp	13 Dec 2002 18:41:05 -0000
@@ -178,6 +178,15 @@
 
 void GrepViewWidget::childFinished(bool normal, int status)
 {
+    // When xargs executes grep several times (because the command line
+    // generated would be too large for a single grep) and one of those
+    // sets of files passed to grep does not contain a match, then an
+    // error status of 123 is set by xargs, even if there is a match in
+    // another set of files.
+    // Reset this false status here.
+    if (status == 123 && numRows() > 1)
+        status = 0;
+
     ProcessWidget::childFinished(normal, status);
     m_part->core()->running(m_part, false);
 }




More information about the KDevelop-devel mailing list