rbs 3.7.0 → 3.8.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +3 -3
- data/.github/workflows/ruby.yml +7 -7
- data/CHANGELOG.md +52 -0
- data/core/array.rbs +1743 -1580
- data/core/basic_object.rbs +38 -35
- data/core/comparable.rbs +1 -1
- data/core/complex.rbs +165 -93
- data/core/data.rbs +1 -1
- data/core/dir.rbs +1 -17
- data/core/encoding.rbs +12 -6
- data/core/enumerable.rbs +270 -266
- data/core/enumerator.rbs +0 -2
- data/core/env.rbs +1 -1
- data/core/errno.rbs +33 -16
- data/core/errors.rbs +2 -2
- data/core/exception.rbs +236 -170
- data/core/fiber.rbs +3 -2
- data/core/file.rbs +32 -74
- data/core/float.rbs +125 -72
- data/core/gc.rbs +138 -40
- data/core/hash.rbs +120 -141
- data/core/integer.rbs +79 -50
- data/core/io/buffer.rbs +49 -43
- data/core/io.rbs +97 -144
- data/core/kernel.rbs +290 -200
- data/core/match_data.rbs +76 -2
- data/core/math.rbs +0 -36
- data/core/module.rbs +28 -23
- data/core/nil_class.rbs +0 -3
- data/core/numeric.rbs +100 -103
- data/core/object.rbs +0 -4
- data/core/object_space/weak_key_map.rbs +3 -4
- data/core/object_space.rbs +3 -3
- data/core/proc.rbs +0 -2
- data/core/process.rbs +109 -57
- data/core/ractor.rbs +37 -4
- data/core/range.rbs +114 -87
- data/core/rational.rbs +0 -2
- data/core/rbs/unnamed/argf.rbs +234 -33
- data/core/rbs/unnamed/env_class.rbs +35 -53
- data/core/rbs/unnamed/random.rbs +1 -2
- data/core/regexp.rbs +4 -52
- data/core/ruby_vm.rbs +88 -9
- data/core/rubygems/config_file.rbs +3 -0
- data/core/rubygems/errors.rbs +0 -5
- data/core/rubygems/platform.rbs +0 -9
- data/core/rubygems/rubygems.rbs +0 -5
- data/core/rubygems/version.rbs +6 -6
- data/core/set.rbs +3 -15
- data/core/string.rbs +130 -136
- data/core/struct.rbs +6 -18
- data/core/symbol.rbs +14 -21
- data/core/thread.rbs +32 -35
- data/core/time.rbs +127 -50
- data/core/trace_point.rbs +16 -0
- data/core/true_class.rbs +0 -1
- data/core/warning.rbs +9 -2
- data/docs/architecture.md +1 -1
- data/docs/syntax.md +1 -1
- data/ext/rbs_extension/location.c +29 -19
- data/ext/rbs_extension/parser.c +267 -292
- data/ext/rbs_extension/parserstate.c +56 -22
- data/lib/rbs/annotate/annotations.rb +3 -3
- data/lib/rbs/annotate/rdoc_source.rb +2 -2
- data/lib/rbs/cli/diff.rb +3 -3
- data/lib/rbs/cli/validate.rb +1 -1
- data/lib/rbs/cli.rb +13 -13
- data/lib/rbs/collection/config.rb +3 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +3 -3
- data/lib/rbs/environment_loader.rb +1 -1
- data/lib/rbs/namespace.rb +1 -0
- data/lib/rbs/parser_aux.rb +2 -2
- data/lib/rbs/prototype/rb.rb +11 -8
- data/lib/rbs/prototype/rbi.rb +9 -5
- data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
- data/lib/rbs/prototype/runtime.rb +4 -5
- data/lib/rbs/type_name.rb +14 -9
- data/lib/rbs/unit_test/type_assertions.rb +2 -2
- data/lib/rbs/validator.rb +3 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +2 -2
- data/rbs.gemspec +4 -0
- data/sig/ancestor_graph.rbs +4 -4
- data/sig/namespace.rbs +2 -3
- data/sig/resolver/constant_resolver.rbs +2 -2
- data/sig/resolver/context.rbs +1 -1
- data/sig/type_alias_regularity.rbs +5 -5
- data/sig/typename.rbs +8 -5
- data/sig/use_map.rbs +1 -1
- data/sig/validator.rbs +2 -2
- data/stdlib/base64/0/base64.rbs +0 -9
- data/stdlib/benchmark/0/benchmark.rbs +11 -2
- data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
- data/stdlib/cgi/0/core.rbs +47 -0
- data/stdlib/coverage/0/coverage.rbs +0 -3
- data/stdlib/csv/0/csv.rbs +18 -58
- data/stdlib/date/0/date.rbs +4 -19
- data/stdlib/did_you_mean/0/did_you_mean.rbs +0 -5
- data/stdlib/digest/0/digest.rbs +25 -2
- data/stdlib/erb/0/erb.rbs +0 -1
- data/stdlib/etc/0/etc.rbs +51 -34
- data/stdlib/fileutils/0/fileutils.rbs +3 -44
- data/stdlib/io-console/0/io-console.rbs +69 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +8 -4
- data/stdlib/json/0/json.rbs +56 -71
- data/stdlib/logger/0/log_device.rbs +1 -1
- data/stdlib/logger/0/logger.rbs +3 -18
- data/stdlib/net-http/0/net-http.rbs +19 -77
- data/stdlib/nkf/0/nkf.rbs +30 -0
- data/stdlib/objspace/0/objspace.rbs +1 -2
- data/stdlib/observable/0/observable.rbs +1 -1
- data/stdlib/open-uri/0/open-uri.rbs +52 -0
- data/stdlib/open3/0/open3.rbs +0 -8
- data/stdlib/openssl/0/openssl.rbs +136 -69
- data/stdlib/optparse/0/optparse.rbs +58 -18
- data/stdlib/pathname/0/pathname.rbs +2 -8
- data/stdlib/pp/0/pp.rbs +3 -1
- data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
- data/stdlib/pstore/0/pstore.rbs +0 -6
- data/stdlib/psych/0/psych.rbs +15 -4
- data/stdlib/pty/0/pty.rbs +46 -4
- data/stdlib/rdoc/0/code_object.rbs +0 -4
- data/stdlib/rdoc/0/markup.rbs +10 -12
- data/stdlib/rdoc/0/rdoc.rbs +1 -2
- data/stdlib/resolv/0/resolv.rbs +8 -3
- data/stdlib/ripper/0/ripper.rbs +0 -2
- data/stdlib/securerandom/0/securerandom.rbs +0 -2
- data/stdlib/shellwords/0/shellwords.rbs +11 -12
- data/stdlib/singleton/0/singleton.rbs +0 -1
- data/stdlib/socket/0/addrinfo.rbs +0 -1
- data/stdlib/socket/0/basic_socket.rbs +0 -5
- data/stdlib/socket/0/socket.rbs +49 -25
- data/stdlib/socket/0/tcp_server.rbs +0 -3
- data/stdlib/socket/0/tcp_socket.rbs +58 -3
- data/stdlib/socket/0/udp_socket.rbs +0 -1
- data/stdlib/socket/0/unix_server.rbs +0 -3
- data/stdlib/strscan/0/string_scanner.rbs +1265 -422
- data/stdlib/tempfile/0/tempfile.rbs +135 -28
- data/stdlib/time/0/time.rbs +48 -35
- data/stdlib/timeout/0/timeout.rbs +11 -8
- data/stdlib/tmpdir/0/tmpdir.rbs +8 -1
- data/stdlib/tsort/0/tsort.rbs +0 -4
- data/stdlib/uri/0/common.rbs +11 -30
- data/stdlib/uri/0/ftp.rbs +1 -1
- data/stdlib/uri/0/generic.rbs +22 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
- data/stdlib/zlib/0/buf_error.rbs +1 -70
- data/stdlib/zlib/0/data_error.rbs +1 -70
- data/stdlib/zlib/0/deflate.rbs +8 -72
- data/stdlib/zlib/0/error.rbs +1 -70
- data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
- data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
- data/stdlib/zlib/0/gzip_file.rbs +1 -71
- data/stdlib/zlib/0/gzip_reader.rbs +3 -74
- data/stdlib/zlib/0/gzip_writer.rbs +1 -70
- data/stdlib/zlib/0/inflate.rbs +4 -71
- data/stdlib/zlib/0/mem_error.rbs +1 -70
- data/stdlib/zlib/0/need_dict.rbs +1 -70
- data/stdlib/zlib/0/stream_end.rbs +1 -70
- data/stdlib/zlib/0/stream_error.rbs +1 -70
- data/stdlib/zlib/0/version_error.rbs +1 -70
- data/stdlib/zlib/0/zlib.rbs +0 -2
- data/stdlib/zlib/0/zstream.rbs +4 -72
- metadata +4 -6
data/core/process.rbs
CHANGED
@@ -13,7 +13,6 @@
|
|
13
13
|
# without waiting for completion.
|
14
14
|
# * Process.exec: Replaces the current process by executing the command.
|
15
15
|
#
|
16
|
-
#
|
17
16
|
# In addition:
|
18
17
|
#
|
19
18
|
# * Method Kernel#system executes a given command-line (string) in a subshell;
|
@@ -23,7 +22,6 @@
|
|
23
22
|
# * Module Open3 supports creating child processes with access to their
|
24
23
|
# $stdin, $stdout, and $stderr streams.
|
25
24
|
#
|
26
|
-
#
|
27
25
|
# ### Execution Environment
|
28
26
|
#
|
29
27
|
# Optional leading argument `env` is a hash of name/value pairs, where each name
|
@@ -52,15 +50,14 @@
|
|
52
50
|
# built-in, or if it contains one or more meta characters.
|
53
51
|
# * `exe_path` otherwise.
|
54
52
|
#
|
55
|
-
#
|
56
|
-
# **Argument `command_line`**
|
53
|
+
# #### Argument `command_line`
|
57
54
|
#
|
58
55
|
# String argument `command_line` is a command line to be passed to a shell; it
|
59
56
|
# must begin with a shell reserved word, begin with a special built-in, or
|
60
57
|
# contain meta characters:
|
61
58
|
#
|
62
59
|
# system('if true; then echo "Foo"; fi') # => true # Shell reserved word.
|
63
|
-
# system('
|
60
|
+
# system('exit') # => true # Built-in.
|
64
61
|
# system('date > /tmp/date.tmp') # => true # Contains meta character.
|
65
62
|
# system('date > /nop/date.tmp') # => false
|
66
63
|
# system('date > /nop/date.tmp', exception: true) # Raises RuntimeError.
|
@@ -76,23 +73,85 @@
|
|
76
73
|
# See [Execution Shell](rdoc-ref:Process@Execution+Shell) for details about the
|
77
74
|
# shell.
|
78
75
|
#
|
79
|
-
#
|
76
|
+
# #### Argument `exe_path`
|
80
77
|
#
|
81
78
|
# Argument `exe_path` is one of the following:
|
82
79
|
#
|
83
|
-
# * The string path to an executable to be called
|
84
|
-
#
|
85
|
-
#
|
80
|
+
# * The string path to an executable file to be called:
|
81
|
+
#
|
82
|
+
# Example:
|
83
|
+
#
|
84
|
+
# system('/usr/bin/date') # => true # Path to date on Unix-style system.
|
85
|
+
# system('foo') # => nil # Command execlution failed.
|
86
|
+
#
|
87
|
+
# Output:
|
88
|
+
#
|
89
|
+
# Thu Aug 31 10:06:48 AM CDT 2023
|
90
|
+
#
|
91
|
+
# A path or command name containing spaces without arguments cannot be
|
92
|
+
# distinguished from `command_line` above, so you must quote or escape the
|
93
|
+
# entire command name using a shell in platform dependent manner, or use the
|
94
|
+
# array form below.
|
95
|
+
#
|
96
|
+
# If `exe_path` does not contain any path separator, an executable file is
|
97
|
+
# searched from directories specified with the `PATH` environment variable.
|
98
|
+
# What the word "executable" means here is depending on platforms.
|
99
|
+
#
|
100
|
+
# Even if the file considered "executable", its content may not be in proper
|
101
|
+
# executable format. In that case, Ruby tries to run it by using `/bin/sh`
|
102
|
+
# on a Unix-like system, like system(3) does.
|
103
|
+
#
|
104
|
+
# File.write('shell_command', 'echo $SHELL', perm: 0o755)
|
105
|
+
# system('./shell_command') # prints "/bin/sh" or something.
|
106
|
+
#
|
107
|
+
# * A 2-element array containing the path to an executable and the string to
|
108
|
+
# be used as the name of the executing process:
|
109
|
+
#
|
110
|
+
# Example:
|
111
|
+
#
|
112
|
+
# pid = spawn(['sleep', 'Hello!'], '1') # 2-element array.
|
113
|
+
# p `ps -p #{pid} -o command=`
|
114
|
+
#
|
115
|
+
# Output:
|
116
|
+
#
|
117
|
+
# "Hello! 1\n"
|
118
|
+
#
|
119
|
+
# ### Arguments `args`
|
120
|
+
#
|
121
|
+
# If `command_line` does not contain shell meta characters except for spaces and
|
122
|
+
# tabs, or `exe_path` is given, Ruby invokes the executable directly. This form
|
123
|
+
# does not use the shell:
|
86
124
|
#
|
125
|
+
# spawn("doesnt_exist") # Raises Errno::ENOENT
|
126
|
+
# spawn("doesnt_exist", "\n") # Raises Errno::ENOENT
|
127
|
+
#
|
128
|
+
# spawn("doesnt_exist\n") # => false
|
129
|
+
# # sh: 1: doesnot_exist: not found
|
130
|
+
#
|
131
|
+
# The error message is from a shell and would vary depending on your system.
|
132
|
+
#
|
133
|
+
# If one or more `args` is given after `exe_path`, each is an argument or option
|
134
|
+
# to be passed to the executable:
|
87
135
|
#
|
88
136
|
# Example:
|
89
137
|
#
|
90
|
-
# system('
|
91
|
-
# system('foo') # => nil # Command failed.
|
138
|
+
# system('echo', '<', 'C*', '|', '$SHELL', '>') # => true
|
92
139
|
#
|
93
140
|
# Output:
|
94
141
|
#
|
95
|
-
#
|
142
|
+
# < C* | $SHELL >
|
143
|
+
#
|
144
|
+
# However, there are exceptions on Windows. See [Execution Shell on
|
145
|
+
# Windows](rdoc-ref:Process@Execution+Shell+on+Windows).
|
146
|
+
#
|
147
|
+
# If you want to invoke a path containing spaces with no arguments without
|
148
|
+
# shell, you will need to use a 2-element array `exe_path`.
|
149
|
+
#
|
150
|
+
# Example:
|
151
|
+
#
|
152
|
+
# path = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
|
153
|
+
# spawn(path) # Raises Errno::ENOENT; No such file or directory - /Applications/Google
|
154
|
+
# spawn([path] * 2)
|
96
155
|
#
|
97
156
|
# ### Execution Options
|
98
157
|
#
|
@@ -133,14 +192,12 @@
|
|
133
192
|
#
|
134
193
|
# * *n*: Specifies file descriptor *n*.
|
135
194
|
#
|
136
|
-
#
|
137
195
|
# There are these shorthand symbols for fds:
|
138
196
|
#
|
139
197
|
# * `:in`: Specifies file descriptor 0 (STDIN).
|
140
198
|
# * `:out`: Specifies file descriptor 1 (STDOUT).
|
141
199
|
# * `:err`: Specifies file descriptor 2 (STDERR).
|
142
200
|
#
|
143
|
-
#
|
144
201
|
# The value given with a source is one of:
|
145
202
|
#
|
146
203
|
# * *n*: Redirects to fd *n* in the parent process.
|
@@ -156,7 +213,6 @@
|
|
156
213
|
# * `[:child, fd]`: Redirects to the redirected `fd`.
|
157
214
|
# * `:close`: Closes the file descriptor in child process.
|
158
215
|
#
|
159
|
-
#
|
160
216
|
# See [Access Modes](rdoc-ref:File@Access+Modes) and [File
|
161
217
|
# Permissions](rdoc-ref:File@File+Permissions).
|
162
218
|
#
|
@@ -194,7 +250,6 @@
|
|
194
250
|
# * `true`: Create a new process group for the new process.
|
195
251
|
# * *pgid*: Create the new process in the process group whose id is *pgid*.
|
196
252
|
#
|
197
|
-
#
|
198
253
|
# On Windows only, use execution option `:new_pgroup` with value `true` to
|
199
254
|
# create a new process group for the new process.
|
200
255
|
#
|
@@ -212,7 +267,6 @@
|
|
212
267
|
# * An integer, specifying both the current and maximum limits.
|
213
268
|
# * A 2-element array of integers, specifying the current and maximum limits.
|
214
269
|
#
|
215
|
-
#
|
216
270
|
# #### File Descriptor Inheritance
|
217
271
|
#
|
218
272
|
# By default, the new process inherits file descriptors from the parent process.
|
@@ -222,23 +276,48 @@
|
|
222
276
|
#
|
223
277
|
# ### Execution Shell
|
224
278
|
#
|
225
|
-
# On a Unix-like system, the shell invoked is `/bin/sh`;
|
226
|
-
#
|
227
|
-
# or `ENV['COMSPEC']` otherwise.
|
228
|
-
#
|
229
|
-
# Except for the `COMSPEC` case, the entire string `command_line` is passed as
|
230
|
-
# an argument to [shell option
|
279
|
+
# On a Unix-like system, the shell invoked is `/bin/sh`; the entire string
|
280
|
+
# `command_line` is passed as an argument to [shell option
|
231
281
|
# -c](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/sh.
|
232
282
|
# html).
|
233
283
|
#
|
234
284
|
# The shell performs normal shell expansion on the command line:
|
235
285
|
#
|
236
|
-
#
|
237
|
-
#
|
286
|
+
# Example:
|
287
|
+
#
|
288
|
+
# system('echo $SHELL: C*') # => true
|
289
|
+
#
|
290
|
+
# Output:
|
291
|
+
#
|
292
|
+
# /bin/bash: CONTRIBUTING.md COPYING COPYING.ja
|
293
|
+
#
|
294
|
+
# #### Execution Shell on Windows
|
295
|
+
#
|
296
|
+
# On Windows, the shell invoked is determined by environment variable
|
297
|
+
# `RUBYSHELL`, if defined, or `COMSPEC` otherwise; the entire string
|
298
|
+
# `command_line` is passed as an argument to `-c` option for `RUBYSHELL`, as
|
299
|
+
# well as `/bin/sh`, and [/c
|
300
|
+
# option](https://learn.microsoft.com/en-us/windows-server/administration/window
|
301
|
+
# s-commands/cmd) for `COMSPEC`. The shell is invoked automatically in the
|
302
|
+
# following cases:
|
303
|
+
#
|
304
|
+
# * The command is a built-in of `cmd.exe`, such as `echo`.
|
305
|
+
# * The executable file is a batch file; its name ends with `.bat` or `.cmd`.
|
306
|
+
#
|
307
|
+
# Note that the command will still be invoked as `command_line` form even when
|
308
|
+
# called in `exe_path` form, because `cmd.exe` does not accept a script name
|
309
|
+
# like `/bin/sh` does but only works with `/c` option.
|
310
|
+
#
|
311
|
+
# The standard shell `cmd.exe` performs environment variable expansion but does
|
312
|
+
# not have globbing functionality:
|
313
|
+
#
|
314
|
+
# Example:
|
315
|
+
#
|
316
|
+
# system("echo %COMSPEC%: C*")' # => true
|
238
317
|
#
|
239
318
|
# Output:
|
240
319
|
#
|
241
|
-
#
|
320
|
+
# C:\WINDOWS\system32\cmd.exe: C*
|
242
321
|
#
|
243
322
|
# ## What's Here
|
244
323
|
#
|
@@ -254,7 +333,6 @@
|
|
254
333
|
# * ::ppid: Returns the process ID of the parent process.
|
255
334
|
# * ::uid: Returns the (real) user ID.
|
256
335
|
#
|
257
|
-
#
|
258
336
|
# ### Current-Process Setters
|
259
337
|
#
|
260
338
|
# * ::egid=: Sets the effective group ID.
|
@@ -267,7 +345,6 @@
|
|
267
345
|
# leader, with no controlling tty.
|
268
346
|
# * ::uid=: Sets the user ID.
|
269
347
|
#
|
270
|
-
#
|
271
348
|
# ### Current-Process Execution
|
272
349
|
#
|
273
350
|
# * ::abort: Immediately terminates the process.
|
@@ -281,7 +358,6 @@
|
|
281
358
|
# application is completed, and that the VM may begin optimizing the
|
282
359
|
# application.
|
283
360
|
#
|
284
|
-
#
|
285
361
|
# ### Child Processes
|
286
362
|
#
|
287
363
|
# * ::detach: Guards against a child process becoming a zombie.
|
@@ -295,7 +371,6 @@
|
|
295
371
|
# * ::waitall: Waits for all child processes to exit; returns their process
|
296
372
|
# IDs and statuses.
|
297
373
|
#
|
298
|
-
#
|
299
374
|
# ### Process Groups
|
300
375
|
#
|
301
376
|
# * ::getpgid: Returns the process group ID for a process.
|
@@ -317,7 +392,6 @@
|
|
317
392
|
# * ::setpriority: Sets the scheduling priority for a process, process group,
|
318
393
|
# or user.
|
319
394
|
#
|
320
|
-
#
|
321
395
|
# ### Timing
|
322
396
|
#
|
323
397
|
# * ::clock_getres: Returns the resolution of a system clock.
|
@@ -448,7 +522,6 @@ module Process
|
|
448
522
|
# * `:CLOCK_UPTIME_RAW_APPROX`: macOS 10.12.
|
449
523
|
# * `:CLOCK_VIRTUAL`: FreeBSD 3.0, OpenBSD 2.1.
|
450
524
|
#
|
451
|
-
#
|
452
525
|
# Note that SUS stands for Single Unix Specification. SUS contains POSIX and
|
453
526
|
# clock_gettime is defined in the POSIX part. SUS defines `:CLOCK_REALTIME` as
|
454
527
|
# mandatory but `:CLOCK_MONOTONIC`, `:CLOCK_PROCESS_CPUTIME_ID`, and
|
@@ -464,7 +537,6 @@ module Process
|
|
464
537
|
# * `:TIME_BASED_CLOCK_REALTIME`: Use time() defined by ISO C. The
|
465
538
|
# resolution is 1 second.
|
466
539
|
#
|
467
|
-
#
|
468
540
|
# * Emulations for `:CLOCK_MONOTONIC`:
|
469
541
|
#
|
470
542
|
# * `:MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC`: Use mach_absolute_time(),
|
@@ -485,7 +557,6 @@ module Process
|
|
485
557
|
# type, the resolution is 10 millisecond and cannot represent over 497
|
486
558
|
# days.
|
487
559
|
#
|
488
|
-
#
|
489
560
|
# * Emulations for `:CLOCK_PROCESS_CPUTIME_ID`:
|
490
561
|
#
|
491
562
|
# * `:GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID`: Use getrusage() defined
|
@@ -508,8 +579,6 @@ module Process
|
|
508
579
|
# `CLOCKS_PER_SEC` is 1000000 and clock_t is a 32-bit integer type, it
|
509
580
|
# cannot represent over 72 minutes.
|
510
581
|
#
|
511
|
-
#
|
512
|
-
#
|
513
582
|
# **Argument `unit`**
|
514
583
|
#
|
515
584
|
# Optional argument `unit` (default `:float_second`) specifies the unit for the
|
@@ -523,7 +592,6 @@ module Process
|
|
523
592
|
# * `:nanosecond`: Number of nanoseconds as an integer.
|
524
593
|
# * `::second`: Number of seconds as an integer.
|
525
594
|
#
|
526
|
-
#
|
527
595
|
# Examples:
|
528
596
|
#
|
529
597
|
# Process.clock_gettime(:CLOCK_PROCESS_CPUTIME_ID, :float_microsecond)
|
@@ -569,7 +637,6 @@ module Process
|
|
569
637
|
# * Changes the current working directory to the root directory.
|
570
638
|
# * Redirects $stdin, $stdout, and $stderr to the null device.
|
571
639
|
#
|
572
|
-
#
|
573
640
|
# If optional argument `nochdir` is `true`, does not change the current working
|
574
641
|
# directory.
|
575
642
|
#
|
@@ -698,7 +765,6 @@ module Process
|
|
698
765
|
# * Process::PRIO_PGRP: return priority for process group.
|
699
766
|
# * Process::PRIO_USER: return priority for user.
|
700
767
|
#
|
701
|
-
#
|
702
768
|
# Argument `id` is the ID for the process, process group, or user; zero
|
703
769
|
# specified the current ID for `kind`.
|
704
770
|
#
|
@@ -787,7 +853,6 @@ module Process
|
|
787
853
|
# * Whether the array includes duplicate group IDs.
|
788
854
|
# * Whether the array size exceeds the value of Process.maxgroups.
|
789
855
|
#
|
790
|
-
#
|
791
856
|
# Use this call to get a sorted and unique array:
|
792
857
|
#
|
793
858
|
# Process.groups.uniq.sort
|
@@ -816,7 +881,6 @@ module Process
|
|
816
881
|
# belongs.
|
817
882
|
# * The group ID `gid`.
|
818
883
|
#
|
819
|
-
#
|
820
884
|
# Example:
|
821
885
|
#
|
822
886
|
# Process.groups # => [0, 1, 2, 3, 4, 6, 10, 11, 20, 26, 27]
|
@@ -840,7 +904,6 @@ module Process
|
|
840
904
|
# * Zero, send the signal to all processes in the current process group.
|
841
905
|
# * Negative, sends the signal to a system-dependent collection of processes.
|
842
906
|
#
|
843
|
-
#
|
844
907
|
# Argument `signal` specifies the signal to be sent; the argument may be:
|
845
908
|
#
|
846
909
|
# * An integer signal number: e.g., `-29`, `0`, `29`.
|
@@ -852,7 +915,6 @@ module Process
|
|
852
915
|
# * `'-SIGPOLL'`.
|
853
916
|
# * `'-POLL'`.
|
854
917
|
#
|
855
|
-
#
|
856
918
|
# * A signal symbol, with or without leading `'SIG'`, and with or without a
|
857
919
|
# further prefixed minus sign (`'-'`): e.g.:
|
858
920
|
#
|
@@ -861,8 +923,6 @@ module Process
|
|
861
923
|
# * `:'-SIGPOLL'`.
|
862
924
|
# * `:'-POLL'`.
|
863
925
|
#
|
864
|
-
#
|
865
|
-
#
|
866
926
|
# If `signal` is:
|
867
927
|
#
|
868
928
|
# * A non-negative integer, or a signal name or symbol without prefixed `'-'`,
|
@@ -870,7 +930,6 @@ module Process
|
|
870
930
|
# * A negative integer, or a signal name or symbol with prefixed `'-'`, each
|
871
931
|
# process group with group ID `id` is signalled.
|
872
932
|
#
|
873
|
-
#
|
874
933
|
# Use method Signal.list to see which signals are supported by Ruby on the
|
875
934
|
# underlying platform; the method returns a hash of the string names and
|
876
935
|
# non-negative integer values of the supported signals. The size and content of
|
@@ -899,7 +958,6 @@ module Process
|
|
899
958
|
# * Raises Errno::ESRCH or RangeError if one of `ids` is invalid.
|
900
959
|
# * Raises Errno::EPERM if needed permissions are not in force.
|
901
960
|
#
|
902
|
-
#
|
903
961
|
# In the last two cases, signals may have been sent to some processes.
|
904
962
|
#
|
905
963
|
def self.kill: (Integer | interned signal, *Integer pids) -> Integer
|
@@ -1031,7 +1089,6 @@ module Process
|
|
1031
1089
|
# * `:SIGPENDING`: Number of queued signals allowed (signals) (GNU/Linux).
|
1032
1090
|
# * `:STACK`: Stack size (bytes) (SUSv3).
|
1033
1091
|
#
|
1034
|
-
#
|
1035
1092
|
# Arguments `cur_limit` and `max_limit` may be:
|
1036
1093
|
#
|
1037
1094
|
# * Integers (`max_limit` should not be smaller than `cur_limit`).
|
@@ -1042,7 +1099,6 @@ module Process
|
|
1042
1099
|
# * Symbol `:INFINITY`, string `'INFINITY'`, or constant
|
1043
1100
|
# `Process::RLIM_INFINITY`: no limit on resource.
|
1044
1101
|
#
|
1045
|
-
#
|
1046
1102
|
# This example raises the soft limit of core size to the hard limit to try to
|
1047
1103
|
# make core dump possible:
|
1048
1104
|
#
|
@@ -1221,15 +1277,13 @@ module Process
|
|
1221
1277
|
# Process.wait(-child1_pid) returned pid 230109, which is child 1 pid.
|
1222
1278
|
# Raised Errno::ECHILD, because there's no longer a child with process group id 230109.
|
1223
1279
|
#
|
1224
|
-
#
|
1225
1280
|
# Argument `flags` should be given as one of the following constants, or as the
|
1226
1281
|
# logical OR of both:
|
1227
1282
|
#
|
1228
1283
|
# * Process::WNOHANG: Does not block if no child process is available.
|
1229
|
-
# * Process
|
1284
|
+
# * Process::WUNTRACED: May return a stopped child process, even if not yet
|
1230
1285
|
# reported.
|
1231
1286
|
#
|
1232
|
-
#
|
1233
1287
|
# Not all flags are available on all platforms.
|
1234
1288
|
#
|
1235
1289
|
# Raises Errno::ECHILD if there is no suitable child process.
|
@@ -1251,7 +1305,7 @@ module Process
|
|
1251
1305
|
# Process.wait2(pid)
|
1252
1306
|
# # => [309581, #<Process::Status: pid 309581 exit 13>]
|
1253
1307
|
#
|
1254
|
-
# Process.waitpid2 is an alias for Process.
|
1308
|
+
# Process.waitpid2 is an alias for Process.wait2.
|
1255
1309
|
#
|
1256
1310
|
def self.wait2: (?Integer pid, ?Integer flags) -> [ Integer, Process::Status ]
|
1257
1311
|
|
@@ -1388,15 +1442,13 @@ module Process
|
|
1388
1442
|
# Process.wait(-child1_pid) returned pid 230109, which is child 1 pid.
|
1389
1443
|
# Raised Errno::ECHILD, because there's no longer a child with process group id 230109.
|
1390
1444
|
#
|
1391
|
-
#
|
1392
1445
|
# Argument `flags` should be given as one of the following constants, or as the
|
1393
1446
|
# logical OR of both:
|
1394
1447
|
#
|
1395
1448
|
# * Process::WNOHANG: Does not block if no child process is available.
|
1396
|
-
# * Process
|
1449
|
+
# * Process::WUNTRACED: May return a stopped child process, even if not yet
|
1397
1450
|
# reported.
|
1398
1451
|
#
|
1399
|
-
#
|
1400
1452
|
# Not all flags are available on all platforms.
|
1401
1453
|
#
|
1402
1454
|
# Raises Errno::ECHILD if there is no suitable child process.
|
@@ -1418,7 +1470,7 @@ module Process
|
|
1418
1470
|
# Process.wait2(pid)
|
1419
1471
|
# # => [309581, #<Process::Status: pid 309581 exit 13>]
|
1420
1472
|
#
|
1421
|
-
# Process.waitpid2 is an alias for Process.
|
1473
|
+
# Process.waitpid2 is an alias for Process.wait2.
|
1422
1474
|
#
|
1423
1475
|
def self.waitpid2: (?Integer pid, ?Integer flags) -> [ Integer, Process::Status ]
|
1424
1476
|
|
data/core/ractor.rbs
CHANGED
@@ -50,7 +50,6 @@
|
|
50
50
|
# * Ractor.yield and Ractor#take for when the *receiver* knows the sender
|
51
51
|
# (pull);
|
52
52
|
#
|
53
|
-
#
|
54
53
|
# In addition to that, any arguments passed to Ractor.new are passed to the
|
55
54
|
# block and available there as if received by Ractor.receive, and the last block
|
56
55
|
# value is sent outside of the ractor as if sent by Ractor.yield.
|
@@ -250,6 +249,30 @@
|
|
250
249
|
# See [Ractor design doc](rdoc-ref:ractor.md) for more details.
|
251
250
|
#
|
252
251
|
class Ractor
|
252
|
+
# <!--
|
253
|
+
# rdoc-file=ractor.rb
|
254
|
+
# - _require(feature)
|
255
|
+
# -->
|
256
|
+
# internal method
|
257
|
+
#
|
258
|
+
def self._require: (String feature) -> bool
|
259
|
+
|
260
|
+
# <!--
|
261
|
+
# rdoc-file=ractor.rb
|
262
|
+
# - [](sym)
|
263
|
+
# -->
|
264
|
+
# get a value from ractor-local storage of current Ractor
|
265
|
+
#
|
266
|
+
def self.[]: (Symbol) -> untyped
|
267
|
+
|
268
|
+
# <!--
|
269
|
+
# rdoc-file=ractor.rb
|
270
|
+
# - []=(sym, val)
|
271
|
+
# -->
|
272
|
+
# set a value in ractor-local storage of current Ractor
|
273
|
+
#
|
274
|
+
def self.[]=: (Symbol, untyped) -> untyped
|
275
|
+
|
253
276
|
# <!--
|
254
277
|
# rdoc-file=ractor.rb
|
255
278
|
# - count()
|
@@ -281,7 +304,15 @@ class Ractor
|
|
281
304
|
# -->
|
282
305
|
# returns main ractor
|
283
306
|
#
|
284
|
-
def self.main: () ->
|
307
|
+
def self.main: () -> Ractor
|
308
|
+
|
309
|
+
# <!--
|
310
|
+
# rdoc-file=ractor.rb
|
311
|
+
# - main?()
|
312
|
+
# -->
|
313
|
+
# return true if the current ractor is main ractor
|
314
|
+
#
|
315
|
+
def self.main?: () -> boolish
|
285
316
|
|
286
317
|
# <!--
|
287
318
|
# rdoc-file=ractor.rb
|
@@ -608,7 +639,8 @@ class Ractor
|
|
608
639
|
# rdoc-file=ractor.rb
|
609
640
|
# - [](sym)
|
610
641
|
# -->
|
611
|
-
# get a value from ractor-local storage
|
642
|
+
# get a value from ractor-local storage of current Ractor Obsolete and use
|
643
|
+
# Ractor.[] instead.
|
612
644
|
#
|
613
645
|
def []: (interned sym) -> untyped
|
614
646
|
|
@@ -616,7 +648,8 @@ class Ractor
|
|
616
648
|
# rdoc-file=ractor.rb
|
617
649
|
# - []=(sym, val)
|
618
650
|
# -->
|
619
|
-
# set a value in ractor-local storage
|
651
|
+
# set a value in ractor-local storage of current Ractor Obsolete and use
|
652
|
+
# Ractor.[]= instead.
|
620
653
|
#
|
621
654
|
def []=: [T] (interned sym, T val) -> T
|
622
655
|
|