All Implemented Interfaces:
Configurable, KeyVal.Mixin, UtilsMixin

public class ExecTask extends Task<ExecTask>
Represents a task that represents the semantics of the Runtime.exec(String[]) system call.

/*
 * Copyright 2022 Thoughtworks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


  exec {
    commandLine = ["curl", "https://gocd.example.com/go/api/version", "-H'Accept: application/vnd.go.cd.v1+json'"]
    workingDir = "foo"
  }

See Also:
  • Constructor Details

  • Method Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Task<ExecTask>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Task<ExecTask>
    • getWorkingDir

      public String getWorkingDir()
      The directory in which the script or command is to be executed.

      Note that this directory is relative to the directory where the agent checks out the materials.

    • getCommandLine

      public List<String> getCommandLine()
      The command line to be executed.
    • setWorkingDir

      public void setWorkingDir(String workingDir)
      The directory in which the script or command is to be executed.

      Note that this directory is relative to the directory where the agent checks out the materials.

    • setCommandLine

      public void setCommandLine(List<String> commandLine)
      The command line to be executed.
    • toString

      public String toString()
      Overrides:
      toString in class Task<ExecTask>