process_executer 3.0.0 → 3.1.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/CHANGELOG.md +9 -0
- data/README.md +3 -0
- data/lib/process_executer/errors.rb +11 -1
- data/lib/process_executer/runner.rb +2 -6
- data/lib/process_executer/version.rb +1 -1
- data/lib/process_executer.rb +6 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6cedd27c98fa7e8e5d7ac1d134a514cdad1bac02fec17e88045729c644d978d
|
4
|
+
data.tar.gz: 3c61d911e0134dd3d083be1773d44910b0218c268733e7bd10b547b83b67dfe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1963744fe4e899bc099f1641587e3e9d722bcf8f4ee1c88795918eadddc9b4f55324d59779f2be0804bf08a2c47267b0d28d6e625fba2588c1dedd075049f484
|
7
|
+
data.tar.gz: 004562c12d9ba5ff76a6a9a0b028c0817631eb3fddbca2dac329a1d594ca843ba08e44b6b33cbaea7292b073d2bdd861bb47b738f7d4eaba506ead916606b5d4
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,15 @@ All notable changes to the process_executer gem will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## v3.1.0 (2025-04-01)
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/main-branch/process_executer/compare/v3.0.0..v3.1.0)
|
11
|
+
|
12
|
+
Changes since v3.0.0:
|
13
|
+
|
14
|
+
* acb6385 fix: give Windows enough time to release its file lock so tmpdir can be deleted
|
15
|
+
* 3fe114a feat: wrap errors raised by `Process.spawn` in a `ProcessExecuter::SpawnError`
|
16
|
+
|
8
17
|
## v3.0.0 (2025-03-18)
|
9
18
|
|
10
19
|
[Full Changelog](https://github.com/main-branch/process_executer/compare/v2.0.0..v3.0.0)
|
data/README.md
CHANGED
@@ -179,6 +179,9 @@ following features:
|
|
179
179
|
* It raises an error if there is any problem with the subprocess. This behavior can
|
180
180
|
be turned off with the `raise_errors: false` option.
|
181
181
|
|
182
|
+
⚠️ `ProcessIOError` and `SpawnError` errors are not suppressed by giving the
|
183
|
+
`raise_errors: false` option.
|
184
|
+
|
182
185
|
```ruby
|
183
186
|
result = ProcessExecuter.run('echo "Hello World"', out: StringIO.new)
|
184
187
|
result.stdout #=> "Hello World\n"
|
@@ -17,7 +17,8 @@ module ProcessExecuter
|
|
17
17
|
# │ ├─> FailedError
|
18
18
|
# │ └─> SignaledError
|
19
19
|
# │ └─> TimeoutError
|
20
|
-
#
|
20
|
+
# ├─> ProcessIOError
|
21
|
+
# └─> SpawnError
|
21
22
|
# ```
|
22
23
|
#
|
23
24
|
# | Error Class | Description |
|
@@ -28,6 +29,7 @@ module ProcessExecuter
|
|
28
29
|
# | `SignaledError` | Raised when the command is terminated as a result of receiving a signal. This could happen if the process is forcibly terminated or if there is a serious system error. |
|
29
30
|
# | `TimeoutError` | This is a specific type of `SignaledError` that is raised when the command times out and is killed via the SIGKILL signal. Raised when the operation takes longer than the specified timeout duration (if provided). |
|
30
31
|
# | `ProcessIOError` | Raised when an error was encountered reading or writing to the command's subprocess. |
|
32
|
+
# | `SpawnError` | Raised when the process could not execute. Check the |
|
31
33
|
#
|
32
34
|
# @example Rescuing any error
|
33
35
|
# begin
|
@@ -129,6 +131,14 @@ module ProcessExecuter
|
|
129
131
|
# @api public
|
130
132
|
#
|
131
133
|
class ProcessIOError < ProcessExecuter::Error; end
|
134
|
+
|
135
|
+
# Raised when spawn could not execute the process
|
136
|
+
#
|
137
|
+
# See the `cause` for the exception that Process.spawn raised.
|
138
|
+
#
|
139
|
+
# @api public
|
140
|
+
#
|
141
|
+
class SpawnError < ProcessExecuter::Error; end
|
132
142
|
end
|
133
143
|
|
134
144
|
# rubocop:enable Layout/LineLength
|
@@ -42,8 +42,7 @@ module ProcessExecuter
|
|
42
42
|
# @param command [Array<String>] The command to execute
|
43
43
|
# @param options [ProcessExecuter::Options::RunOptions] Options for running the command
|
44
44
|
#
|
45
|
-
# @raise [ProcessExecuter::
|
46
|
-
# @raise [ProcessExecuter::TimeoutError] If the command times out
|
45
|
+
# @raise [ProcessExecuter::Error] if the command could not be executed or failed
|
47
46
|
#
|
48
47
|
# @return [ProcessExecuter::Result] The result of the completed subprocess
|
49
48
|
#
|
@@ -100,10 +99,7 @@ module ProcessExecuter
|
|
100
99
|
#
|
101
100
|
# @return [Void]
|
102
101
|
#
|
103
|
-
# @raise [ProcessExecuter::
|
104
|
-
# @raise [ProcessExecuter::SignaledError] If the command was signaled
|
105
|
-
# @raise [ProcessExecuter::TimeoutError] If the command times out
|
106
|
-
# @raise [ProcessExecuter::ProcessIOError] If an exception was raised while collecting subprocess output
|
102
|
+
# @raise [ProcessExecuter::Error] if the command could not be executed or failed
|
107
103
|
#
|
108
104
|
# @api private
|
109
105
|
#
|
data/lib/process_executer.rb
CHANGED
@@ -87,7 +87,11 @@ module ProcessExecuter
|
|
87
87
|
# @return [ProcessExecuter::Result] The result of the completed subprocess
|
88
88
|
# @api private
|
89
89
|
def self.spawn_and_wait_with_options(command, options)
|
90
|
-
|
90
|
+
begin
|
91
|
+
pid = Process.spawn(*command, **options.spawn_options)
|
92
|
+
rescue StandardError => e
|
93
|
+
raise ProcessExecuter::SpawnError, "Failed to spawn process: #{e.message}"
|
94
|
+
end
|
91
95
|
wait_for_process(pid, command, options)
|
92
96
|
end
|
93
97
|
|
@@ -287,10 +291,7 @@ module ProcessExecuter
|
|
287
291
|
# @option options_hash [String] :chdir (nil) The directory to run the command in
|
288
292
|
# @option options_hash [Logger] :logger The logger to use
|
289
293
|
#
|
290
|
-
# @raise [ProcessExecuter::
|
291
|
-
# @raise [ProcessExecuter::SignaledError] if the command exited because of an unhandled signal
|
292
|
-
# @raise [ProcessExecuter::TimeoutError] if the command timed out
|
293
|
-
# @raise [ProcessExecuter::ProcessIOError] if an exception was raised while collecting subprocess output
|
294
|
+
# @raise [ProcessExecuter::Error] if the command could not be executed or failed
|
294
295
|
#
|
295
296
|
# @return [ProcessExecuter::Result] The result of the completed subprocess
|
296
297
|
#
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: process_executer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Couball
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-04-01 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bundler-audit
|
@@ -250,8 +250,8 @@ metadata:
|
|
250
250
|
allowed_push_host: https://rubygems.org
|
251
251
|
homepage_uri: https://github.com/main-branch/process_executer
|
252
252
|
source_code_uri: https://github.com/main-branch/process_executer
|
253
|
-
documentation_uri: https://rubydoc.info/gems/process_executer/3.
|
254
|
-
changelog_uri: https://rubydoc.info/gems/process_executer/3.
|
253
|
+
documentation_uri: https://rubydoc.info/gems/process_executer/3.1.0
|
254
|
+
changelog_uri: https://rubydoc.info/gems/process_executer/3.1.0/file/CHANGELOG.md
|
255
255
|
rubygems_mfa_required: 'true'
|
256
256
|
rdoc_options: []
|
257
257
|
require_paths:
|