Hi, i have another problem as i am trying to conve...
# community-support
g
Hi, i have another problem as i am trying to convert our code to support the configuration cache: i need the result of a command line execution as an input for a task.
Copy code
interface Services {
    @get:Inject val exec: ExecOperations
}

tasks.register("calculateCliProperties") {
    val exec = project.objects.newInstance<Services>().exec

    val stdOut = ByteArrayOutputStream()
    exec.exec {
        commandLine("some command")
        standardOutput = stdOut
    }
    
    val cliResult = stdOut.toString()
    inputs.property("cliResult", cliResult)

    doLast {
        ... do something with the result... 
    }
}
of course this won't work, because i get this error:
> Starting an external process '...' during configuration time is unsupported.
what would be the right way to be able to both use that result during the task execution AND being able to set it as an input, so it can determine how we cache?
e
create a provider from a custom ValueSource
a
g
yes, thank you, i went with using the
ValueSource
, and it workeD!