CommandLine { public CommandResult executeSilently() { executeSilentlyCalled = true; return doExecute(); } CommandLine(TaskContext taskContext, ProcessFactory processFactory); CommandLine add(String... arguments); CommandLine add(Collection<String> arguments); CommandLine addTokens(String arguments); CommandResult execute(); CommandResult executeSilently(); void recordSilentExecutionAsSystemModification(); String programName(); @Override String toString(); CommandLine discardStderr(); CommandLine ignoreExitCode(); CommandLine setSuccessfulExitCodePredicate(Predicate<Integer> successPredicate); CommandLine setOutputEncoding(Charset outputEncoding); CommandLine setOutputFile(Path outputFile); CommandLine setTimeout(Duration timeout); CommandLine setMaxOutputBytes(long maxOutputBytes); CommandLine setSigTermGracePeriod(Duration period); CommandLine setSigKillGracePeriod(Duration period); CommandLine doNotWaitForTermination(); List<String> getArguments(); static final Duration DEFAULT_TIMEOUT; static final long DEFAULT_MAX_OUTPUT_BYTES; static final Duration DEFAULT_SIGTERM_GRACE_PERIOD; static final Duration DEFAULT_SIGKILL_GRACE_PERIOD; }
@Test public void executeSilently() { terminal.ignoreCommand(""); commandLine.add("foo", "bar").executeSilently(); assertEquals(0, context.getSystemModificationLog().size()); commandLine.recordSilentExecutionAsSystemModification(); assertEquals(1, context.getSystemModificationLog().size()); assertEquals("Executed command: foo bar 2>&1", context.getSystemModificationLog().get(0)); }