Class ShellStep

    • Field Detail

      • workingDirectory

        protected final Path workingDirectory
        If specified, working directory will be different from build cell root. This should be relative to the build cell root.
    • Constructor Detail

      • ShellStep

        protected ShellStep​(Path workingDirectory)
      • ShellStep

        protected ShellStep​(AbsPath workingDirectory)
    • Method Detail

      • addOptions

        protected void addOptions​(com.google.common.collect.ImmutableSet.Builder<ProcessExecutor.Option> options)
      • getDuration

        public long getDuration()
      • getShellCommand

        public final com.google.common.collect.ImmutableList<String> getShellCommand​(ExecutionContext context)
        This method is idempotent.
        Returns:
        the shell command arguments
      • getShellCommandArgsForDescription

        protected com.google.common.collect.ImmutableList<String> getShellCommandArgsForDescription​(ExecutionContext context)
      • getShellCommandInternal

        protected abstract com.google.common.collect.ImmutableList<String> getShellCommandInternal​(ExecutionContext context)
        Implementations of this method should not have any observable side-effects.
      • getEnvironmentVariables

        public com.google.common.collect.ImmutableMap<String,​String> getEnvironmentVariables​(ExecutionContext context)
        Returns the environment variables to include when running this ShellStep.

        By default, this method returns an empty map.

        Parameters:
        context - that may be useful when determining environment variables to include.
      • shouldPrintStdout

        protected boolean shouldPrintStdout​(Verbosity verbosity)
        Parameters:
        verbosity - is provided in case that affects what should be printed.
        Returns:
        whether the stdout of the shell command, when executed, should be printed to the stderr of the specified ExecutionContext. If false, stdout will only be printed on error and only if verbosity is set to standard information.
      • getStdout

        public final String getStdout()
        Returns:
        the stdout of this ShellCommand or throws an exception if the stdout was not recorded
      • shouldPrintStderr

        protected boolean shouldPrintStderr​(Verbosity verbosity)
        Returns:
        whether the stderr of the shell command, when executed, should be printed to the stderr of the specified ExecutionContext. If false, stderr will only be printed on error and only if verbosity is set to standard information.
      • getStderr

        public final String getStderr()
        Returns:
        the stderr of this ShellCommand or throws an exception if the stderr was not recorded
      • getTimeout

        protected Optional<Long> getTimeout()
        Returns:
        an optional timeout to apply to the step.
      • getTimeoutHandler

        protected Optional<java.util.function.Consumer<Process>> getTimeoutHandler​(ExecutionContext context)
        Returns:
        an optional timeout handler Function to do something before the process is killed.