Skip to content

Instantly share code, notes, and snippets.

@cdsap
Created October 27, 2022 21:26
Show Gist options
  • Save cdsap/c552cd073390983cb31b5d4f00c08b36 to your computer and use it in GitHub Desktop.
Save cdsap/c552cd073390983cb31b5d4f00c08b36 to your computer and use it in GitHub Desktop.
CurlRequestValueSource
abstract class CurlRequestValueSource : ValueSource<String, CurlRequestValueSource.Parameters> {
interface Parameters : ValueSourceParameters {
val server: Property<String>
}
@get:Inject
abstract val execOperations: ExecOperations
override fun obtain(): String {
return execOperations.exec {
commandLine("curl", "-s", "--max-time", "2", parameters.server.get())
isIgnoreExitValue = true
}.exitValue.toString()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment