mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
improve utils
This commit is contained in:
@@ -9,7 +9,7 @@ package sonia.scm.web.cgi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.util.Util;
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -164,6 +164,11 @@ public class CGIRunner
|
||||
execCmd = cmdPrefix + " " + execCmd;
|
||||
}
|
||||
|
||||
if (logger.isLoggable(Level.FINE))
|
||||
{
|
||||
logger.fine("execute cgi: ".concat(execCmd));
|
||||
}
|
||||
|
||||
Process p = (dir == null)
|
||||
? Runtime.getRuntime().exec(execCmd, env.getEnvArray())
|
||||
: Runtime.getRuntime().exec(execCmd, env.getEnvArray(), dir);
|
||||
@@ -193,6 +198,11 @@ public class CGIRunner
|
||||
{
|
||||
logger.log(Level.FINEST, null, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(inFromReq);
|
||||
IOUtil.close(outToCgi);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
@@ -244,7 +254,7 @@ public class CGIRunner
|
||||
|
||||
// copy cgi content to response stream...
|
||||
os = res.getOutputStream();
|
||||
Util.copy(inFromCgi, os);
|
||||
IOUtil.copy(inFromCgi, os);
|
||||
p.waitFor();
|
||||
|
||||
if (!ignoreExitState)
|
||||
@@ -280,7 +290,7 @@ public class CGIRunner
|
||||
{
|
||||
if (os != null)
|
||||
{
|
||||
Util.close(os);
|
||||
IOUtil.close(os);
|
||||
}
|
||||
|
||||
os = null;
|
||||
|
||||
Reference in New Issue
Block a user