private Object readResolve() throws ObjectStreamException { BatchFile batch = new BatchFile(command); batch.setUnstableReturn(unstableReturn); return batch; }
@Override public Builder newInstance(StaplerRequest req, JSONObject data) { return new BatchFile(data.getString("command")); }
@DataBoundConstructor public BatchFile(String command, boolean disabled, String description) { super(command); setDisabled(disabled); setDescription(description); }
@Override public Builder newInstance(StaplerRequest req, JSONObject data) { return new BatchFile(data.getString("command")); }
@Override public Builder newInstance(StaplerRequest req, JSONObject data) { return new BatchFile(data.getString("command")); }
private Object readResolve() throws ObjectStreamException { BatchFile batch = new BatchFile(command); batch.setUnstableReturn(unstableReturn); return batch; }
@Override public Builder newInstance(StaplerRequest req, JSONObject data) { return new BatchFile(data.getString("command"), data.getBoolean("disabled"), data.getString("description")); }
private CommandInterpreter createInterpreter(String scriptContent) { if (launcher.isUnix()) { return new Shell(scriptContent); } return new BatchFile(scriptContent); }
private void addFingerprinterToProject(FreeStyleProject project, String[] contents, String[] files) throws Exception { StringBuilder targets = new StringBuilder(); for (int i = 0; i < contents.length; i++) { String command = "echo $BUILD_NUMBER " + contents[i] + " > " + files[i]; project.getBuildersList().add(Functions.isWindows() ? new BatchFile(command) : new Shell(command)); targets.append(files[i]).append(','); } project.getPublishersList().add(new Fingerprinter(targets.toString())); } }
private int executeScriptContent(@Nonnull FilePath scriptExecutionRoot, @Nonnull String scriptContent, @Nonnull Map<String, String> scriptExecutionEnvVars) throws EnvInjectException { try { CommandInterpreter batchRunner; if (launcher.isUnix()) { batchRunner = new Shell(scriptContent); } else { batchRunner = new BatchFile(scriptContent); } FilePath tmpFile = batchRunner.createScriptFile(scriptExecutionRoot); logger.info(String.format("Executing and processing the following script content: %n%s%n", scriptContent)); int cmdCode = launcher.launch().cmds(batchRunner.buildCommandLine(tmpFile)).stdout(launcher.getListener()) .envs(scriptExecutionEnvVars).pwd(scriptExecutionRoot).join(); if (cmdCode != 0) { logger.info(String.format("Script executed. The exit code is %s.", cmdCode)); } else { logger.info("Script executed successfully."); } return cmdCode; } catch (IOException ioe) { throw new EnvInjectException("Error occurs on execution script file path", ioe); } catch (InterruptedException ie) { throw new EnvInjectException("Error occurs on execution script file path", ie); } }
batchRunner = new Shell(scriptContent); } else { batchRunner = new BatchFile(scriptContent);