mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update PTY.spawn's document
Passing the optional env hash to PTY.spawn has been supported for years, but it's never documented. More info: https://bugs.ruby-lang.org/issues/12312
This commit is contained in:
parent
dbb227d3b6
commit
629bad4aba
Notes:
git
2022-04-14 04:43:48 +09:00
1 changed files with 11 additions and 4 deletions
|
@ -539,10 +539,10 @@ pty_detach_process(VALUE v)
|
|||
|
||||
/*
|
||||
* call-seq:
|
||||
* 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.
|
||||
|
@ -550,6 +550,13 @@ pty_detach_process(VALUE v)
|
|||
* 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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue