From 19726080e2d387c8e9d6b25568bab9fc3e89bfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20R?= Date: Fri, 9 Jan 2015 17:33:20 +0100 Subject: [PATCH] Catch curl errors in github scripts --- bin/postComment.php | 8 +++++++- bin/setCommitStatus.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/postComment.php b/bin/postComment.php index 7b18ff5..0a2ae09 100755 --- a/bin/postComment.php +++ b/bin/postComment.php @@ -15,5 +15,11 @@ json_encode( array( "body" => file_get_contents( $argv[3] ) ) ) ); -curl_exec( $ch ); +if ( curl_exec( $ch ) === false ) +{ + echo "\n\n# postComment.php curl error:\n" . curl_error( $ch ) . "\n\n"; + curl_close( $ch ); + exit( 1 ); +} + curl_close( $ch ); diff --git a/bin/setCommitStatus.php b/bin/setCommitStatus.php index 09cc4e4..9f48dea 100755 --- a/bin/setCommitStatus.php +++ b/bin/setCommitStatus.php @@ -29,5 +29,11 @@ ) ); -curl_exec( $ch ); +if ( curl_exec( $ch ) === false ) +{ + echo "\n\n# setCommit.php curl error:\n" . curl_error( $ch ) . "\n\n"; + curl_close( $ch ); + exit( 1 ); +} + curl_close( $ch );