summaryrefslogtreecommitdiff
path: root/qadevOOo/runner/helper/ProcessHandler.java
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2009-07-06 10:30:52 +0000
committerVladimir Glazounov <vg@openoffice.org>2009-07-06 10:30:52 +0000
commit91ab2cabe11981d03007616f55acb0119b0435d7 (patch)
treebc1fa4dd94212de4fae7f10762f44f831ebace26 /qadevOOo/runner/helper/ProcessHandler.java
parent4910706670c8a17c46347fa22c63d5779d50fbcc (diff)
CWS-TOOLING: integrate CWS unoapi04
2009-06-26 14:00:27 +0200 lla r273410 : #i102248# cleanups 2009-06-26 13:36:44 +0200 lla r273407 : #i102248# fix problem with too long sleeps and waits 2009-06-26 08:34:17 +0200 lla r273393 : #i102248# cleanups 2009-06-26 08:28:43 +0200 lla r273392 : #i102248# cleanups 2009-06-25 13:17:19 +0200 lla r273379 : #i102248# add prototypes 2009-06-25 11:31:02 +0200 lla r273371 : #i102248# cleanups 2009-06-25 11:15:18 +0200 lla r273370 : #i102248# add a selftest for demonstration. 2009-06-25 10:53:35 +0200 lla r273369 : #i102248# add a selftest for demonstration. 2009-06-25 10:38:10 +0200 lla r273368 : #i102248# add a selftest for demonstration. 2009-06-23 11:09:35 +0200 lla r273266 : #i102248# cleanup 2009-06-23 11:00:15 +0200 lla r273265 : #i10i108248# add cwstestresult to cwscheckapi 2009-06-23 10:59:50 +0200 lla r273264 : #i10i108248# add cwstestresult to cwscheckapi 2009-06-23 10:58:47 +0200 lla r273263 : #i102248# add selftest
Diffstat (limited to 'qadevOOo/runner/helper/ProcessHandler.java')
-rw-r--r--qadevOOo/runner/helper/ProcessHandler.java51
1 files changed, 32 insertions, 19 deletions
diff --git a/qadevOOo/runner/helper/ProcessHandler.java b/qadevOOo/runner/helper/ProcessHandler.java
index 9939a73bf215..859f00a55593 100644
--- a/qadevOOo/runner/helper/ProcessHandler.java
+++ b/qadevOOo/runner/helper/ProcessHandler.java
@@ -366,17 +366,20 @@ public class ProcessHandler
{
ow = (OfficeWatcher) param.get(PropertyName.OFFICE_WATCHER);
}
+ if (ow != null)
+ {
+ ow.ping();
+ }
+ int hangcheck = 10;
while (!this.isFinished() && changedText)
{
count++;
- if (ow != null)
- {
- ow.ping();
- }
- dbg("runCommand: waiting " + mTimeOut / 1000 + " seconds while command execution is ongoing... " + count);
- shortWait(mTimeOut);
+ // dbg("runCommand: waiting " + mTimeOut / 1000 + " seconds while command execution is ongoing... " + count);
+ // shortWait(mTimeOut);
+ // shortWait(2000); // wait 2 seconds.
//waitFor(mTimeOut);
+ waitFor(2000, false); // wait but don't kill
if (ow != null)
{
@@ -385,13 +388,18 @@ public class ProcessHandler
// check for changes in the output stream. If there are no changes, the process maybe hangs
if (!this.isFinished())
{
- if (this.getOutputText().length() == memText.length())
+ hangcheck--;
+ if (hangcheck < 0)
{
- changedText = false;
- dbg("runCommand Could not detect changes in output stream!!!");
-
+ String sOutputText = getOutputText();
+ if (sOutputText.length() == memText.length())
+ {
+ changedText = false;
+ // dbg("runCommand Could not detect changes in output stream!!!");
+ }
+ hangcheck = 10;
+ memText = this.getOutputText();
}
- memText = this.getOutputText();
}
}
@@ -539,9 +547,6 @@ public class ProcessHandler
stderr = new Pump(m_aProcess.getErrorStream(), log, "err > ");
stdIn = new PrintStream(m_aProcess.getOutputStream());
- // int nExitValue = m_aProcess.exitValue();
- // int dummy = 0;
-
dbg("execute: flush io-streams");
flushInput();
@@ -578,7 +583,12 @@ public class ProcessHandler
* @return <code>true</code> if process correctly exited
* (exit code doesn't affect to this result).
*/
- public boolean waitFor(long timeout)
+ public boolean waitFor(long timeout)
+ {
+ return waitFor(timeout, true);
+ }
+
+ private boolean waitFor(long timeout, boolean bKillProcessAfterTimeout)
{
if (isFinished())
{
@@ -638,11 +648,14 @@ public class ProcessHandler
}
}
- if (!isFinished)
+ if (bKillProcessAfterTimeout == true)
{
- log.println("Going to destroy the process!!");
- m_aProcess.destroy();
- log.println("Process has been destroyed!");
+ if (!isFinished)
+ {
+ log.println("Going to destroy the process!!");
+ m_aProcess.destroy();
+ log.println("Process has been destroyed!");
+ }
}
// Removed as hung up in SDK test 'PathSettings'
// try {