kintomiko / jodconverter

Automatically exported from code.google.com/p/jodconverter
0 stars 0 forks source link

jodconverter won't build on Windows with sigar #97

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Checkout the source on Windows and build.

What is the expected output? What do you see instead?
Expected: BUILD SUCCESSFUL
Instead: 
Failed tests:
  sigarProcessManager(org.artofsolving.jodconverter.process.ProcessManagerTest): kill failed

Please use labels and text to provide additional information.
sigarProcessManager(org.artofsolving.jodconverter.process.ProcessManagerTest)  
Time elapsed: 0.062 sec  <<< FAILURE!
java.io.IOException: kill failed
    at org.artofsolving.jodconverter.process.SigarProcessManager.kill(SigarProcessManager.java:62)
    at org.artofsolving.jodconverter.process.ProcessManagerTest.sigarProcessManager(ProcessManagerTest.java:62)
Caused by: org.hyperic.sigar.SigarException: kill: invalid signal specification
    at org.hyperic.sigar.Sigar.kill(Sigar.java:279)
    at org.artofsolving.jodconverter.process.SigarProcessManager.kill(SigarProcessManager.java:60)
    ... 36 more

The problem is really within sigar, but it's probably simpler to fix within 
jodconverter.
There are no signals on Windows, so Sigar.getSigNum returns -1 for (almost?) 
all signal names.
Unfortunately Sigar.kill(long pid, String signame) throws an exception if 
signum < 0.

On Windows any non-zero signum passed to kill will have the same effect 
(TerminateProcess) - so even if -1 was passed in it would be OK.

Original issue reported on code.google.com by jim.tal...@groupgti.com on 24 Oct 2011 at 1:15

GoogleCodeExporter commented 8 years ago
To get around the problem I've changed my implementation of 
SigarProcessManager.kill to have:
            sigar.kill(pid, Sigar.getSigNum( "KILL" ) );

That will result in a signal of -1 being sent on Windows (which is OK) and on 
other systems that don't support SIGKILL (which will probably result in EINVAL).

Original comment by jim.tal...@groupgti.com on 24 Oct 2011 at 1:31

GoogleCodeExporter commented 8 years ago
I am guessing you have correctly configured sigar and included the appropriate 
runtime library from sigar-dist?

Its strange that this is a problem inside sigar, since Sigar should support 
windows also.

However, I can investigate a bit more when I have time, and commit your changes 
to trunk. I don´t see a problem with it at first glance.

Original comment by shervin.asgari@gmail.com on 26 Oct 2011 at 11:01

GoogleCodeExporter commented 8 years ago
Yes I have the correct runtime library loaded (otherwise it wouldn't do 
anything).
Reading the source code shows that the problem is there - I guess sigar could 
argue that it's a question of how it is used rather than a problem with sigar 
itself, but as it stands it makes the kill(long pid, String signame) method 
unusable in a cross-platform manner.

Original comment by jim.tal...@groupgti.com on 8 Nov 2011 at 10:28

GoogleCodeExporter commented 8 years ago
The error 
sigarProcessManager(org.artofsolving.jodconverter.process.ProcessManagerTest): 
kill failed happens to me when I try do a officeManager.stop() without doing a 
officeManager.start() first.

Original comment by SergioCa...@gmail.com on 9 Nov 2011 at 3:52

GoogleCodeExporter commented 8 years ago
Added changes to trunk

Original comment by shervin.asgari@gmail.com on 2 Dec 2011 at 11:45