Issue #6651 has been updated by nobu (Nobuyoshi N.).
Status changed from Open to Closed
r36230
Feature #6651: Re: [ruby-cvs:43389] nobu:r36213 (trunk): popen: shell
commands with envvar
Author: nobu (Nobuyoshi N.)
Status: Closed
Priority: Normal
Assignee:
Category:
Target version:
=begin
なかだです。
: At Mon, 25 Jun 2012 17:13:56 +0900,
: Tanaka A. wrote in [ruby-dev:45812]:
とりあえず、現在はドキュメントと整合していない状態になっています。
すいません、自分で入れた仕様を忘れてました。
何がしたいかというと環境変数を指定してpopenをしたい、ただしコマ
ンドはArrayにはわかれていない単一の文字列、といったところです。
例えばgitがページャーを実行するのにやっているようなことです。
IO.popen(“LESS=RSs #{ENV[‘PAGER’]}”, “w”)
今のところenvやexec optionを指定するのはcmdがArrayでないとできま
せんが、Arrayの外に出してしまうというのを考えました。
IO.popen({“LESS”=>“RSs”}, ENV[‘PAGER’], “w”)
IO.popen({“LANG”=>“C”}, “ls non-existent”, err:[:child, :out])
もちろんArrayを使っても同じです。
IO.popen({“LANG”=>“C”}, [“ls”, “non-existent”], err:[:child, :out])
パッチは popen: shell commands with envvars and execopts by nobu · Pull Request #134 · ruby/ruby · GitHub です。
–
— 僕の前にBugはない。
— 僕の後ろにBugはできる。
中田 伸悦
=end