Project

General

Profile

Actions

Feature #6651

closed

Re: [ruby-cvs:43389] nobu:r36213 (trunk): popen: shell commands with envvar

Added by nobu (Nobuyoshi Nakada) almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Assignee:
-
Target version:
[ruby-dev:45853]

Description

=begin
なかだです。

: At Mon, 25 Jun 2012 17:13:56 +0900,
: Tanaka Akira 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])

パッチは https://github.com/ruby/ruby/pull/134 です。

--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦
=end

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

  • Status changed from Open to Closed

r36230

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

  • Category set to core
  • Target version set to 2.0.0
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0