Created
October 27, 2022 21:26
-
-
Save cdsap/c552cd073390983cb31b5d4f00c08b36 to your computer and use it in GitHub Desktop.
CurlRequestValueSource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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