diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-02-27 19:08:38 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-02-27 19:08:38 +0300 |
commit | f0a64399c1171d2757c8ce70a36517d556cd9233 (patch) | |
tree | 709e0caabebf31ac2530ab007b7c288345b4af11 /lib/gitlab/plugin.rb | |
parent | 2150b2cde2700a48095db4364d02f91c9b9a1456 (diff) |
Refactor plugin execution method
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/gitlab/plugin.rb')
-rw-r--r-- | lib/gitlab/plugin.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/gitlab/plugin.rb b/lib/gitlab/plugin.rb index 3e82f5cb0d8..96332362a4c 100644 --- a/lib/gitlab/plugin.rb +++ b/lib/gitlab/plugin.rb @@ -13,11 +13,20 @@ module Gitlab end def self.execute(file, data) - _output, exit_status = Gitlab::Popen.popen([file]) do |stdin| + result = Gitlab::Popen.popen_with_detail([file]) do |stdin| stdin.write(data.to_json) end + exit_status = result.status&.exitstatus + + unless exit_status.zero? + Rails.logger.error("Plugin Error => #{file}: #{result.stderr}") + end + exit_status.zero? + rescue => e + Rails.logger.error("Plugin Error => #{file}: #{e.message}") + false end end end |