aw 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/README.md +3 -3
- data/lib/aw/fork.rb +2 -2
- data/lib/aw.rb +4 -8
- metadata +6 -118
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e73149e7b499dddb359e9995c9cfe6b1af71d2bb63789f9bf0e13d029893b10
|
4
|
+
data.tar.gz: debe86862bee16a1902fb2c1b6448ba7d5bff733fa5ed0470cce4af5a2d30cb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92954fad1db8bae390956d76c27cffb0fe399c55f2df5b16f102a2a69345a09b62d64a0694864036745f4cb4ceb89a7e143547d035da743e3abd22c0d1ffa14a
|
7
|
+
data.tar.gz: a1eb7a51f4bd7c068ace563f093e2ba94235067bd773a7921f6f175cf9a2a559ba045b9b54fe6f021b5b114ad33bdab48bbc0843ef617ea9fe42a386ae52ef79
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Aw
|
2
2
|
|
3
|
-
[![Version](https://img.shields.io/github/v/tag/fixrb/aw?label=Version&logo=github)](https://github.com/fixrb/aw/
|
3
|
+
[![Version](https://img.shields.io/github/v/tag/fixrb/aw?label=Version&logo=github)](https://github.com/fixrb/aw/tags)
|
4
4
|
[![Yard documentation](https://img.shields.io/badge/Yard-documentation-blue.svg?logo=github)](https://rubydoc.info/github/fixrb/aw/main)
|
5
|
-
[![
|
5
|
+
[![Ruby](https://github.com/fixrb/aw/workflows/Ruby/badge.svg?branch=main)](https://github.com/fixrb/aw/actions?query=workflow%3Aruby+branch%3Amain)
|
6
6
|
[![RuboCop](https://github.com/fixrb/aw/workflows/RuboCop/badge.svg?branch=main)](https://github.com/fixrb/aw/actions?query=workflow%3Arubocop+branch%3Amain)
|
7
7
|
[![License](https://img.shields.io/github/license/fixrb/aw?label=License&logo=github)](https://github.com/fixrb/aw/raw/main/LICENSE.md)
|
8
8
|
|
@@ -115,5 +115,5 @@ The [gem](https://rubygems.org/gems/aw) is available as open source under the te
|
|
115
115
|
This project is sponsored by:<br />
|
116
116
|
<a href="https://sashite.com/"><img
|
117
117
|
src="https://github.com/fixrb/aw/raw/main/img/sashite.png"
|
118
|
-
alt="
|
118
|
+
alt="Sashité" /></a>
|
119
119
|
</p>
|
data/lib/aw/fork.rb
CHANGED
@@ -36,8 +36,8 @@ module Aw
|
|
36
36
|
#
|
37
37
|
# @raise [Exception] Exceptions raised in a block of code are propagated.
|
38
38
|
# @return [#object_id] Returns the value that has been returned in the block.
|
39
|
-
def call(&
|
40
|
-
pid = fork_and_return_pid(&
|
39
|
+
def call(&)
|
40
|
+
pid = fork_and_return_pid(&)
|
41
41
|
write.close
|
42
42
|
result = read.read
|
43
43
|
::Process.wait(pid)
|
data/lib/aw.rb
CHANGED
@@ -12,8 +12,6 @@
|
|
12
12
|
module Aw
|
13
13
|
# Runs the block inside a sub-process, and returns the computed value.
|
14
14
|
#
|
15
|
-
# @param block [Proc] The code to run in a sub-process.
|
16
|
-
#
|
17
15
|
# @example Computes `6 * 7` in a sub-process and returns `42` to the current process.
|
18
16
|
# Aw.fork! { 6 * 7 } # => 42
|
19
17
|
#
|
@@ -22,16 +20,14 @@ module Aw
|
|
22
20
|
#
|
23
21
|
# @raise [Exception] Exceptions raised in a block of code are propagated.
|
24
22
|
# @return [#object_id] Returns the value that has been returned in the block.
|
25
|
-
def self.fork!(&
|
23
|
+
def self.fork!(&)
|
26
24
|
read, write = ::IO.pipe
|
27
|
-
Fork.new(read, write).call(&
|
25
|
+
Fork.new(read, write).call(&)
|
28
26
|
end
|
29
27
|
|
30
28
|
# Runs the block inside a sub-process, and returns `true` if no exception is
|
31
29
|
# thrown. Otherwise when an exception is raised, `false` is returned.
|
32
30
|
#
|
33
|
-
# @param block [Proc] The code to run in a sub-process.
|
34
|
-
#
|
35
31
|
# @example Computes `6 * 7` in a sub-process and returns `true` to the current process.
|
36
32
|
# Aw.fork? { 6 * 7 } # => true
|
37
33
|
#
|
@@ -39,8 +35,8 @@ module Aw
|
|
39
35
|
# Aw.fork? { nil + 1 } # => false
|
40
36
|
#
|
41
37
|
# @return [Boolean] Returns `true` if stat is successful, `false` if not.
|
42
|
-
def self.fork?(&
|
43
|
-
pid = ::Process.fork(&
|
38
|
+
def self.fork?(&)
|
39
|
+
pid = ::Process.fork(&)
|
44
40
|
_, status = ::Process.wait2(pid)
|
45
41
|
status.success?
|
46
42
|
end
|
metadata
CHANGED
@@ -1,129 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rubocop-md
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop-performance
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop-thread_safety
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: simplecov
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: yard
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
11
|
+
date: 2024-01-25 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
125
13
|
description: Creates a sub-process to execute a block inside, and returns what it
|
126
|
-
returns
|
14
|
+
returns.
|
127
15
|
email: contact@cyril.email
|
128
16
|
executables: []
|
129
17
|
extensions: []
|
@@ -146,14 +34,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
34
|
requirements:
|
147
35
|
- - ">="
|
148
36
|
- !ruby/object:Gem::Version
|
149
|
-
version: 2.
|
37
|
+
version: 3.2.0
|
150
38
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
39
|
requirements:
|
152
40
|
- - ">="
|
153
41
|
- !ruby/object:Gem::Version
|
154
42
|
version: '0'
|
155
43
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
44
|
+
rubygems_version: 3.4.19
|
157
45
|
signing_key:
|
158
46
|
specification_version: 4
|
159
47
|
summary: "Aw, fork \U0001F62C"
|