File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,20 @@ def exec_git_command(cmd, stdin: nil)
195
195
# no-dd-sa:ruby-security/shell-injection
196
196
out , status = Open3 . capture2e ( cmd , stdin_data : stdin )
197
197
198
- raise "Failed to run git command #{ cmd } : #{ out } " unless status . success?
198
+ if status . nil?
199
+ retry_count = 5
200
+ Datadog . logger . debug { "Opening pipe failed, starting retries..." }
201
+ while status . nil? && retry_count . positive?
202
+ # no-dd-sa:ruby-security/shell-injection
203
+ out , status = Open3 . capture2e ( cmd , stdin_data : stdin )
204
+ Datadog . logger . debug { "After retry status is [#{ status } ]" }
205
+ retry_count -= 1
206
+ end
207
+ end
208
+
209
+ if status . nil? || !status . success?
210
+ raise "Failed to run git command [#{ cmd } ] with input [#{ stdin } ] and output [#{ out } ]"
211
+ end
199
212
200
213
# Sometimes Encoding.default_external is somehow set to US-ASCII which breaks
201
214
# commit messages with UTF-8 characters like emojis
@@ -213,7 +226,7 @@ def exec_git_command(cmd, stdin: nil)
213
226
214
227
def log_failure ( e , action )
215
228
Datadog . logger . debug (
216
- "Unable to read #{ action } : #{ e . class . name } #{ e . message } at #{ Array ( e . backtrace ) . first } "
229
+ "Unable to perform #{ action } : #{ e . class . name } #{ e . message } at #{ Array ( e . backtrace ) . first } "
217
230
)
218
231
end
219
232
end
You can’t perform that action at this time.
0 commit comments