diff --git a/src/windows/Win32ProjectRecoll.vcxproj b/src/windows/Win32ProjectRecoll.vcxproj
index 2e98600f..20abc8e1 100644
--- a/src/windows/Win32ProjectRecoll.vcxproj
+++ b/src/windows/Win32ProjectRecoll.vcxproj
@@ -152,6 +152,7 @@
+
diff --git a/src/windows/Win32ProjectRecoll.vcxproj.filters b/src/windows/Win32ProjectRecoll.vcxproj.filters
index 3ec1a77e..d1235f2b 100644
--- a/src/windows/Win32ProjectRecoll.vcxproj.filters
+++ b/src/windows/Win32ProjectRecoll.vcxproj.filters
@@ -93,6 +93,9 @@
Header Files
+
+ Header Files
+
diff --git a/src/windows/execmd_w.cpp b/src/windows/execmd_w.cpp
index 1512f86d..c5265557 100644
--- a/src/windows/execmd_w.cpp
+++ b/src/windows/execmd_w.cpp
@@ -512,7 +512,7 @@ int ExecCmd::send(const string& data)
return -1;
}
- WaitResult waitRes = Wait(m->oInputWrite.hEvent, 5000);
+ WaitResult waitRes = Wait(m->oInputWrite.hEvent, m->timeoutMs);
if (waitRes == Ok) {
if (!GetOverlappedResult(m->hInputWrite,
&m->oInputWrite, &dwWritten, TRUE)) {
@@ -569,7 +569,9 @@ int ExecCmd::receive(string& data, int cnt)
}
totread += dwRead;
data.append(chBuf, dwRead);
- LOGDEB1(("ExecCmd::receive: got %d bytes\n", int(dwRead)));
+ if (m->advise)
+ m->advise->newData(dwRead);
+ LOGDEB(("ExecCmd::receive: got %d bytes\n", int(dwRead)));
} else if (waitRes == Quit) {
if (!CancelIo(m->hOutputRead)) {
printError("CancelIo");
@@ -577,11 +579,16 @@ int ExecCmd::receive(string& data, int cnt)
break;
} else if (waitRes == Timeout) {
// We only want to cancel if m_advise says so here. Is the io still
- // valid at this point ?
- if (!CancelIo(m->hOutputRead)) {
- printError("CancelIo");
- }
- break;
+ // valid at this point ? Should we catch a possible exception to CancelIo?
+ if (m->advise)
+ m->advise->newData(0);
+ if (m->killRequest) {
+ LOGINFO(("ExecCmd::doexec: cancel request\n"));
+ if (!CancelIo(m->hOutputRead)) {
+ printError("CancelIo");
+ }
+ break;
+ }
}
}
return totread;
diff --git a/src/windows/trexecmd.cpp b/src/windows/trexecmd.cpp
index 6ae08bdf..ee0d8ff3 100644
--- a/src/windows/trexecmd.cpp
+++ b/src/windows/trexecmd.cpp
@@ -151,11 +151,12 @@ public:
void newData(int cnt) {
if (op_flags & OPT_c) {
static int callcnt;
- if (callcnt++ == 10) {
+ if (callcnt++ == 5) {
// Just sets the cancellation flag
CancelCheck::instance().setCancel();
// Would be called from somewhere else and throws an
// exception. We call it here for simplicity
+ cerr << "newData: should throw !\n";
CancelCheck::instance().checkCancel();
}
}
@@ -223,7 +224,13 @@ int main(int argc, char *argv[])
case 'm': op_flags |= OPT_m; break;
case 'i': op_flags |= OPT_i; break;
case 'o': op_flags |= OPT_o; break;
- case'h': cout << "MESSAGE FROM TREXECMD\n"; return 0;
+ case'h':
+ for (int i = 0; i < 10; i++) {
+ cout << "MESSAGE " << i << " FROM TREXECMD\n";
+ cout.flush();
+ sleep(1);
+ }
+ return 0;
default: Usage(); break;
}
b1: argc--; argv++;
@@ -265,10 +272,10 @@ int main(int argc, char *argv[])
// Set callback to be called whenever there is new data
// available and at a periodic interval, to check for
// cancellation
-#ifdef LATER
MEAdv adv;
mexec.setAdvise(&adv);
- mexec.setTimeout(5);
+ //mexec.setTimeout(5);
+#ifdef LATER
// Stderr output goes there
mexec.setStderr("/tmp/trexecStderr");
#endif