DevOps with project.exec

I am writing a custom plugin and tasks which run native commands.
I know how to do this running scripts but I would like to have more direct control.
Here is a short clip from my @TaskAction.

...
when {
  OperatingSystem.current().isLinux -> {
    project.exec {
      commandLine("/bin/bash")
      args("-s", "--")
      standardInput = """
echo "hello from linux"
        """.trimIndent().byteInputStream(Charsets.UTF_8)
    }
  }
  OperatingSystem.current().isWindows -> {
    project.exec {
      commandLine("start")
      args("%comspec%")
      standardInput = """
echo "hello from windows"
        """.trimIndent().byteInputStream(Charsets.UTF_8)
    }
  }
  else ->
    logger.error("unknown OS family ${OperatingSystem.current()}")
}
...

What would be appropriate values for the commandLine and args for running these scripts?

The commands here are short and could easily be run as part of args.
Imagine that these commands are tens of lines and running them as args would be inappropriate.

It would be helpful to know what the default values are for things like executable, commandLine, etc.
I am not seeing it in the documentation.

I am not seeing where exec is defined in the source.

There are no default values, what should they be? A random executable to execute?

And why don’t you see where it is defined? You linked the file where it is defined, just use Ctrl+F :wink:

Thanks for the information.