public static int callProgram(String commandLine, OutputStream stdOutStream, OutputStream stdErrStream) throws IOException { return callProgram(commandLine, stdOutStream, stdErrStream, null); }
public static int callProgram(String commandLine, Logger logger) throws IOException { return callProgram(commandLine, logger, null); }
public static int callProgram(String commandLine, OutputStream stdOutStream, OutputStream stdErrStream) throws IOException { return callProgram(commandLine, stdOutStream, stdErrStream, null); }
public static int callProgram(String commandLine, Logger logger) throws IOException { return callProgram(commandLine, logger, null); }
@Override public boolean performAction(File product, Metadata productMetadata) throws CrawlerActionException { try { String envReplacedExecuteCommand = doDynamicReplacement( executeCommand, productMetadata); return ExecUtils.callProgram( envReplacedExecuteCommand, LOG, new File(workingDir != null ? doDynamicReplacement(workingDir, productMetadata) : product.getParent())) == 0; } catch (Exception e) { LOG.log(Level.SEVERE, "Failed to execute extern command '" + executeCommand + "' : " + e.getMessage(), e); return false; } }
status = ExecUtils.callProgram(envReplacedExecuteCommand, workingDir);
status = ExecUtils.callProgram(envReplacedExecuteCommand, workingDir);
protected void runPge() throws Exception { ScriptFile sf = null; try { long startTime = System.currentTimeMillis(); logger.info("PGE start time [{}]", new Date(startTime)); // create script to run sf = buildPgeRunScript(); sf.writeScriptFile(getScriptPath().getAbsolutePath()); // run script and evaluate whether success or failure updateStatus(RUNNING_PGE.getWorkflowStatusName()); logger.debug("Starting execution of PGE: {}", sf.getCommands()); if (!wasPgeSuccessful(ExecUtils.callProgram( pgeConfig.getShellType() + " " + getScriptPath(), julLogger, new File(pgeConfig.getExeDir()).getAbsoluteFile()))) { logger.error("PGE didn't finish successfully: {}", sf); throw new RuntimeException("Pge didn't finish successfully"); } else { logger.info("Successfully completed running script file: '{}'", sf); } long endTime = System.currentTimeMillis(); logger.info("PGE end time [{}]", new Date(startTime)); long runTime = endTime - startTime; logger.info("PGE runtime in millis [{}]", runTime); pgeMetadata.replaceMetadata(PGE_RUNTIME, Long.toString(runTime)); } catch (WorkflowException | IOException e) { logger.error("Error when executing PGE commands: {}", sf); throw new PGEException("Exception when executing PGE commands '" + (sf.getCommands()) + "' : " + e.getMessage(), e); } }
+ "] with workingDir: [" + workingDir + "] to extract metadata"); status = ExecUtils.callProgram(commandLineArgs, workingDir); } catch (IOException e) { LOG.log(Level.WARNING,
+ "] with workingDir: [" + workingDir + "] to extract metadata"); status = ExecUtils.callProgram(commandLineArgs, workingDir); } catch (IOException e) { LOG.log(Level.WARNING,
public static int callProgram(String commandLine, Logger logger, File workDir) throws IOException { LoggerOutputStream loggerInfoStream = null; LoggerOutputStream loggerSevereStream = null; try { return callProgram( commandLine, loggerInfoStream = new LoggerOutputStream(logger, Level.INFO), loggerSevereStream = new LoggerOutputStream(logger, Level.SEVERE), workDir); } catch (Exception e) { throw new IOException(e); } finally { try { if (loggerInfoStream != null) { loggerInfoStream.close(); } } catch (Exception ignored) {} try { if (loggerSevereStream != null) { loggerSevereStream.close(); } } catch (Exception ignored) {} } }
public static int callProgram(String commandLine, Logger logger, File workDir) throws IOException { LoggerOutputStream loggerInfoStream = null; LoggerOutputStream loggerSevereStream = null; try { return callProgram( commandLine, loggerInfoStream = new LoggerOutputStream(logger, Level.INFO), loggerSevereStream = new LoggerOutputStream(logger, Level.SEVERE), workDir); } catch (Exception e) { throw new IOException(e); } finally { try { if (loggerInfoStream != null) { loggerInfoStream.close(); } } catch (Exception ignored) {} try { if (loggerSevereStream != null) { loggerSevereStream.close(); } } catch (Exception ignored) {} } }