process_executer 1.0.2 → 1.1.1
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/.tool-versions +1 -1
- data/CHANGELOG.md +20 -0
- data/README.md +9 -1
- data/lib/process_executer/options.rb +0 -2
- data/lib/process_executer/status.rb +44 -0
- data/lib/process_executer/version.rb +1 -1
- data/lib/process_executer.rb +4 -3
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d476a9c88bc9491b887b5a5507dd2288f1aadf1b4735c8c15b790dbbfa423f9
|
|
4
|
+
data.tar.gz: 763c100ce03c3f625e323fefcdafe3788300c51429296110a5aa9222eb05d039
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f27eebdee1a46bac93ecfa8c78d29feba3ebb2c833d53dda7cd3213ee43c441994f50e0317592898a31d0eff42ca3a83cc3e3ad201d746fd641c7de9d3d9d762
|
|
7
|
+
data.tar.gz: 1e303f09b81b1605cfef527b41fbfc52f8e247a10c5ad3af1bed944bab2d6cf839eac9850b1b1c6038d73549abd1e7d0cef18de3dc081930f8d764512a3adc43
|
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby 3.
|
|
1
|
+
ruby 3.3.5
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,26 @@ 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
|
+
## v1.1.1 (2024-09-25)
|
|
9
|
+
|
|
10
|
+
[Full Changelog](https://github.com/main-branch/process_executer/compare/v1.1.0..v1.1.1)
|
|
11
|
+
|
|
12
|
+
Changes since v1.1.0:
|
|
13
|
+
|
|
14
|
+
* c3f063a Use a later version of ruby for development
|
|
15
|
+
* d4eeb1e Use latest version of the actions/checkout to v4
|
|
16
|
+
* eb4dad7 Fix flakey test on JRuby
|
|
17
|
+
* ac9417a Update CI build to run on v1.x branch
|
|
18
|
+
* 014e70f Remove unused require for 'forwardable' and 'ostruct' (for v1.x)
|
|
19
|
+
|
|
20
|
+
## v1.1.0 (2024-02-02)
|
|
21
|
+
|
|
22
|
+
[Full Changelog](https://github.com/main-branch/process_executer/compare/v1.0.2..v1.1.0)
|
|
23
|
+
|
|
24
|
+
Changes since v1.0.2:
|
|
25
|
+
|
|
26
|
+
* a473281 ProcessExecuter.spawn should indicate if the subprocess timed out or not (#43)
|
|
27
|
+
|
|
8
28
|
## v1.0.2 (2024-02-01)
|
|
9
29
|
|
|
10
30
|
[Full Changelog](https://github.com/main-branch/process_executer/compare/v1.0.1..v1.0.2)
|
data/README.md
CHANGED
|
@@ -77,7 +77,15 @@ important behaviorial differences:
|
|
|
77
77
|
2. A timeout can be specified using the `:timeout` option
|
|
78
78
|
|
|
79
79
|
If the command does not terminate before the timeout, the process is killed by
|
|
80
|
-
sending it the SIGKILL signal.
|
|
80
|
+
sending it the SIGKILL signal. The returned status object's `timeout?` attribute will
|
|
81
|
+
return `true`. For example:
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
status = ProcessExecuter.spawn('sleep 10', timeout: 0.01)
|
|
85
|
+
status.signaled? #=> true
|
|
86
|
+
status.termsig #=> 9
|
|
87
|
+
status.timeout? #=> true
|
|
88
|
+
```
|
|
81
89
|
|
|
82
90
|
## Installation
|
|
83
91
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'delegate'
|
|
4
|
+
|
|
5
|
+
module ProcessExecuter
|
|
6
|
+
# A simple delegator for Process::Status that adds a `timeout?` attribute
|
|
7
|
+
#
|
|
8
|
+
# @api public
|
|
9
|
+
#
|
|
10
|
+
class Status < SimpleDelegator
|
|
11
|
+
extend Forwardable
|
|
12
|
+
|
|
13
|
+
# Create a new Status object from a Process::Status and timeout flag
|
|
14
|
+
#
|
|
15
|
+
# @param status [Process::Status] the status to delegate to
|
|
16
|
+
# @param timeout [Boolean] true if the process timed out
|
|
17
|
+
#
|
|
18
|
+
# @example
|
|
19
|
+
# status = Process.wait2(pid).last
|
|
20
|
+
# timeout = false
|
|
21
|
+
# ProcessExecuter::Status.new(status, timeout)
|
|
22
|
+
#
|
|
23
|
+
# @api public
|
|
24
|
+
#
|
|
25
|
+
def initialize(status, timeout)
|
|
26
|
+
super(status)
|
|
27
|
+
@timeout = timeout
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @!attribute [r] timeout?
|
|
31
|
+
#
|
|
32
|
+
# True if the process timed out and was sent the SIGKILL signal
|
|
33
|
+
#
|
|
34
|
+
# @example
|
|
35
|
+
# status = ProcessExecuter.spawn('sleep 10', timeout: 0.01)
|
|
36
|
+
# status.timeout? # => true
|
|
37
|
+
#
|
|
38
|
+
# @return [Boolean]
|
|
39
|
+
#
|
|
40
|
+
# @api public
|
|
41
|
+
#
|
|
42
|
+
def timeout? = @timeout
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/process_executer.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'process_executer/monitored_pipe'
|
|
4
4
|
require 'process_executer/options'
|
|
5
|
+
require 'process_executer/status'
|
|
5
6
|
|
|
6
7
|
require 'timeout'
|
|
7
8
|
|
|
@@ -59,16 +60,16 @@ module ProcessExecuter
|
|
|
59
60
|
# @param pid [Integer] the process id
|
|
60
61
|
# @param options [ProcessExecuter::Options] the options used
|
|
61
62
|
#
|
|
62
|
-
# @return [
|
|
63
|
+
# @return [ProcessExecuter::Status] the status of the process
|
|
63
64
|
#
|
|
64
65
|
# @api private
|
|
65
66
|
#
|
|
66
67
|
private_class_method def self.wait_for_process(pid, options)
|
|
67
68
|
Timeout.timeout(options.timeout) do
|
|
68
|
-
Process.wait2(pid).last
|
|
69
|
+
ProcessExecuter::Status.new(Process.wait2(pid).last, false)
|
|
69
70
|
end
|
|
70
71
|
rescue Timeout::Error
|
|
71
72
|
Process.kill('KILL', pid)
|
|
72
|
-
Process.wait2(pid).last
|
|
73
|
+
ProcessExecuter::Status.new(Process.wait2(pid).last, true)
|
|
73
74
|
end
|
|
74
75
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: process_executer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Couball
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-09-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler-audit
|
|
@@ -190,6 +190,7 @@ files:
|
|
|
190
190
|
- lib/process_executer.rb
|
|
191
191
|
- lib/process_executer/monitored_pipe.rb
|
|
192
192
|
- lib/process_executer/options.rb
|
|
193
|
+
- lib/process_executer/status.rb
|
|
193
194
|
- lib/process_executer/version.rb
|
|
194
195
|
- process_executer.gemspec
|
|
195
196
|
homepage: https://github.com/main-branch/process_executer
|
|
@@ -199,8 +200,8 @@ metadata:
|
|
|
199
200
|
allowed_push_host: https://rubygems.org
|
|
200
201
|
homepage_uri: https://github.com/main-branch/process_executer
|
|
201
202
|
source_code_uri: https://github.com/main-branch/process_executer
|
|
202
|
-
changelog_uri: https://rubydoc.info/gems/process_executer/1.
|
|
203
|
-
documentation_uri: https://rubydoc.info/gems/process_executer/1.
|
|
203
|
+
changelog_uri: https://rubydoc.info/gems/process_executer/1.1.1/file/CHANGELOG.md
|
|
204
|
+
documentation_uri: https://rubydoc.info/gems/process_executer/1.1.1
|
|
204
205
|
rubygems_mfa_required: 'true'
|
|
205
206
|
post_install_message:
|
|
206
207
|
rdoc_options: []
|
|
@@ -217,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
217
218
|
- !ruby/object:Gem::Version
|
|
218
219
|
version: '0'
|
|
219
220
|
requirements: []
|
|
220
|
-
rubygems_version: 3.
|
|
221
|
+
rubygems_version: 3.5.16
|
|
221
222
|
signing_key:
|
|
222
223
|
specification_version: 4
|
|
223
224
|
summary: An API for executing commands in a subprocess
|