dependabot-common 0.122.1 → 0.123.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of dependabot-common might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86a9ccf63224238e2e7f39527f062c1f24f393d321adef7fb79a6723f943baa2
4
- data.tar.gz: fac6a851e46d4be8107ca182e24beaea98849a59ab8bd3881e4149646e9f7e13
3
+ metadata.gz: 103a0b99bbafd483f6b638fabd7aeb5276a4d59794869a42ee7e4d64381b592d
4
+ data.tar.gz: 419bfa957b475a720c7d469899f1f5ca473e15a2779534d9dc33f10b9d8dd90c
5
5
  SHA512:
6
- metadata.gz: 7cbc55bfba0ad3fe380e192fa93fa1b789ca03a997357656a226b671b80425d5a84d4e769a2df9b7571659e8a218427573e7a139fc8a01956cb940a4e5028769
7
- data.tar.gz: dbf7ee136e1f93f7fa27a5495c70e6dcc6c0107728000f386c1605e621ab3a287a62d00fd60fd4debe1967e611b4e64aa7e25a7451fe55520eea5107841bec14
6
+ metadata.gz: 1385b30618626289217bebead094c165ca50bb62ff6e26d805fc52200a64e8e4b7f447cc2959a6d9aa6f863dae73a68b66a34d1f9ce82c8ab256c70c23126b72
7
+ data.tar.gz: 9d09fbff160f5301a4ea22cdcb6150dc1d87e3a01e8cc316a97ecfa629655a49e2d59b069196d5a923d1076de1992fd3dbb181bd27614835f3ebd787de9184c3
@@ -57,34 +57,12 @@ module Dependabot
57
57
  end
58
58
  end
59
59
 
60
- def self.in_a_forked_process
61
- read, write = IO.pipe
62
-
63
- pid = fork do
64
- read.close
65
- result = yield
66
- rescue Exception => e # rubocop:disable Lint/RescueException
67
- result = { _error_details: { error_class: e.class.to_s,
68
- error_message: e.message,
69
- error_backtrace: e.backtrace } }
70
- ensure
71
- Marshal.dump(result, write)
72
- exit!(0)
73
- end
74
-
75
- write.close
76
- result = read.read
77
- Process.wait(pid)
78
- result = Marshal.load(result) # rubocop:disable Security/MarshalLoad
79
-
80
- return result unless result.is_a?(Hash) && result[:_error_details]
81
-
82
- raise ChildProcessFailed, result[:_error_details]
83
- end
84
-
85
60
  class HelperSubprocessFailed < StandardError
86
- def initialize(message:, error_context:)
61
+ attr_reader :error_class, :error_context
62
+
63
+ def initialize(message:, error_context:, error_class: nil)
87
64
  super(message)
65
+ @error_class = error_class || ""
88
66
  @error_context = error_context
89
67
  @command = error_context[:command]
90
68
  end
@@ -110,6 +88,11 @@ module Dependabot
110
88
  stdout, stderr, process = Open3.capture3(*env_cmd, stdin_data: stdin_data)
111
89
  time_taken = Time.now - start
112
90
 
91
+ if ENV["DEBUG_HELPERS"] == "true"
92
+ puts stdout
93
+ puts stderr
94
+ end
95
+
113
96
  # Some package managers output useful stuff to stderr instead of stdout so
114
97
  # we want to parse this, most package manager will output garbage here so
115
98
  # would mess up json response from stdout
@@ -129,11 +112,13 @@ module Dependabot
129
112
 
130
113
  raise HelperSubprocessFailed.new(
131
114
  message: response["error"],
115
+ error_class: response["error_class"],
132
116
  error_context: error_context
133
117
  )
134
118
  rescue JSON::ParserError
135
119
  raise HelperSubprocessFailed.new(
136
120
  message: stdout || "No output from command",
121
+ error_class: "JSON::ParserError",
137
122
  error_context: error_context
138
123
  )
139
124
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.122.1"
4
+ VERSION = "0.123.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.122.1
4
+ version: 0.123.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot