Last active
February 12, 2020 08:33
-
-
Save melastmohican/a30aa95ae271ef4beea051dead10b766 to your computer and use it in GitHub Desktop.
Download file using curl in groovy
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
#!/usr/bin/env groovy | |
def execute(command) { | |
def proc = command.execute() | |
def out = new StringBuffer() | |
def err = new StringBuffer() | |
proc.consumeProcessOutput(out, err) | |
proc.waitFor() | |
if( out.size() > 0 ) println out | |
if( err.size() > 0 ) println err | |
return [ 'out':out.toString(), 'err':err.toString() ] | |
} | |
// --max-time <seconds> | |
def response = execute("curl --max-time 6 --retry 6 -O http://www.scscourt.org/online_services/jury/jury_duty.shtml#tables") | |
assert response['out'] == '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment