stdlib/pty/0/pty.rbs in rbs-3.0.0.dev.2 vs stdlib/pty/0/pty.rbs in rbs-3.0.0.dev.3
- old
+ new
@@ -74,21 +74,29 @@
#
def self.check: (Integer pid, ?boolish raise) -> Process::Status?
# <!--
# rdoc-file=ext/pty/pty.c
- # - PTY.spawn(command_line) { |r, w, pid| ... }
- # - PTY.spawn(command_line) => [r, w, pid]
- # - PTY.spawn(command, arguments, ...) { |r, w, pid| ... }
- # - PTY.spawn(command, arguments, ...) => [r, w, pid]
+ # - PTY.spawn([env,] command_line) { |r, w, pid| ... }
+ # - PTY.spawn([env,] command_line) => [r, w, pid]
+ # - PTY.spawn([env,] command, arguments, ...) { |r, w, pid| ... }
+ # - PTY.spawn([env,] command, arguments, ...) => [r, w, pid]
# -->
# Spawns the specified command on a newly allocated pty. You can also use the
# alias ::getpty.
#
# The command's controlling tty is set to the slave device of the pty and its
# standard input/output/error is redirected to the slave device.
#
+ # `env` is an optional hash that provides additional environment variables to
+ # the spawned pty.
+ #
+ # # sets FOO to "bar"
+ # PTY.spawn({"FOO"=>"bar"}, "printenv", "FOO") { |r,w,pid| p r.read } #=> "bar\r\n"
+ # # unsets FOO
+ # PTY.spawn({"FOO"=>nil}, "printenv", "FOO") { |r,w,pid| p r.read } #=> ""
+ #
# `command` and `command_line` are the full commands to run, given a String. Any
# additional `arguments` will be passed to the command.
#
# ### Return values
#
@@ -150,19 +158,27 @@
def self.open: () -> [ IO, File ]
| [A] () { ([ IO, File ]) -> A } -> A
# <!--
# rdoc-file=ext/pty/pty.c
- # - PTY.spawn(command_line) { |r, w, pid| ... }
- # - PTY.spawn(command_line) => [r, w, pid]
- # - PTY.spawn(command, arguments, ...) { |r, w, pid| ... }
- # - PTY.spawn(command, arguments, ...) => [r, w, pid]
+ # - PTY.spawn([env,] command_line) { |r, w, pid| ... }
+ # - PTY.spawn([env,] command_line) => [r, w, pid]
+ # - PTY.spawn([env,] command, arguments, ...) { |r, w, pid| ... }
+ # - PTY.spawn([env,] command, arguments, ...) => [r, w, pid]
# -->
# Spawns the specified command on a newly allocated pty. You can also use the
# alias ::getpty.
#
# The command's controlling tty is set to the slave device of the pty and its
# standard input/output/error is redirected to the slave device.
+ #
+ # `env` is an optional hash that provides additional environment variables to
+ # the spawned pty.
+ #
+ # # sets FOO to "bar"
+ # PTY.spawn({"FOO"=>"bar"}, "printenv", "FOO") { |r,w,pid| p r.read } #=> "bar\r\n"
+ # # unsets FOO
+ # PTY.spawn({"FOO"=>nil}, "printenv", "FOO") { |r,w,pid| p r.read } #=> ""
#
# `command` and `command_line` are the full commands to run, given a String. Any
# additional `arguments` will be passed to the command.
#
# ### Return values