dependabot-common 0.122.1 → 0.123.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dependabot/shared_helpers.rb +11 -26
- data/lib/dependabot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 103a0b99bbafd483f6b638fabd7aeb5276a4d59794869a42ee7e4d64381b592d
|
|
4
|
+
data.tar.gz: 419bfa957b475a720c7d469899f1f5ca473e15a2779534d9dc33f10b9d8dd90c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
data/lib/dependabot/version.rb
CHANGED