[ 
https://issues.apache.org/jira/browse/EXEC-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13157264#comment-13157264
 ] 

Sebb commented on EXEC-34:
--------------------------

Or just change the patch headers. Instead of

{quote}
diff --git a/src/main/java/org/apache/commons/exec/DefaultExecutor.java 
b/src/main/java/org/apache/commons/exec/DefaultExecutor.java
index 2182d85..2110e02 100644
--- a/src/main/java/org/apache/commons/exec/DefaultExecutor.java
+++ b/src/main/java/org/apache/commons/exec/DefaultExecutor.java
{quote}

change it to be

{quote}
--- src/main/java/org/apache/commons/exec/DefaultExecutor.java
+++ src/main/java/org/apache/commons/exec/DefaultExecutor.java
{quote}

and it should work.

Yes, it's a bit tedious. 
I find I often have to do a similar trick with Eclipse-generated patches which 
default to being relative to the workspace. This is not portable, unless both 
workspaces use exactly the same project names.
                
> Race condition prevent watchdog working using ExecuteStreamHandler
> ------------------------------------------------------------------
>
>                 Key: EXEC-34
>                 URL: https://issues.apache.org/jira/browse/EXEC-34
>             Project: Commons Exec
>          Issue Type: Bug
>         Environment: Windows Vista 64bit, dual core CPU
>            Reporter: Marco Ferrante
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>         Attachments: EXEC34.patch
>
>
> Consider this test case (in _DefaultExecutorTest_ class):
> {noformat}
>     /**
>      * Start a async process using a stream handler and terminate it manually
>      * before the watchdog timeout occurs
>      */
>     public void testExecuteAsyncWithStreamHandlerAndUserTermination() throws 
> Exception {
>         CommandLine cl = new CommandLine(foreverTestScript);
>         ExecuteWatchdog watchdog = new ExecuteWatchdog(Integer.MAX_VALUE);
>         PumpStreamHandler streamHanlder = new PumpStreamHandler(System.out, 
> System.err);
>         exec.setStreamHandler(streamHanlder);
>         MockExecuteResultHandler handler = new MockExecuteResultHandler();
>         exec.execute(cl, handler);
>         // DON'T wait for script to run
>         //Thread.sleep(2000);
>         // teminate it
>         watchdog.destroyProcess();
>         assertTrue("Watchdog should have killed the 
> process",watchdog.killedProcess());
>     }
> {noformat}
> It fails (at least in my environment) because when 
> _watchdog.destroyProcess()_ is invoked the external process is not bound to 
> the watchdog yet.
> Although there are possible several workarounds, but all of them seem to me 
> very intrusive in the code. So, I prefer some discussion before preparing and 
> submitting a patch.
> IMHO, the watchdog should handle a reference to the thread running the 
> process, not to the process itself. In this way, interrupting signals can be 
> transport using default _interrupt()_ method of class _Thread_.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to