44件ヒット
[1-44件を表示]
(0.045秒)
別のキーワード
種類
- インスタンスメソッド (33)
- 変数 (11)
クラス
-
ARGF
. class (11) - IO (22)
モジュール
- Kernel (11)
キーワード
-
$ stdin (11) -
close
_ on _ exec= (11) - closed? (22)
検索結果
-
IO
# closed? -> bool (62151.0) -
self が完全に(読み込み用と書き込み用の両方が)クローズされている場合に true を返します。 そうでない場合は false を返します。
...t[例][ruby]{
IO.write("testfile", "test")
f = File.new("testfile")
f.close # => nil
f.closed? # => true
f = IO.popen("/bin/sh","r+")
f.close_write # => nil
f.closed? # => false
f.close_read # => nil
f.closed? # => true
//}
@see IO#close, IO#close_read, IO#close_write... -
IO
# close _ on _ exec=(bool) (21014.0) -
自身に close-on-exec フラグを設定します。
...2)
@param bool 自身の close-on-exec フラグを true か false で指定します。
f = open("/dev/null")
f.close_on_exec = true
system("cat", "/proc/self/fd/#{f.fileno}") # cat: /proc/self/fd/3: No such file or directory
f.closed? #=> false
@see IO#close_on_exec?... -
ARGF
. class # closed? -> bool (18121.0) -
現在開いている処理対象のファイルがARGFがcloseされていればtrueを返します。
...ルを閉じていないのでfalseになる
ARGF.closed? # => false
ARGF.filename # => "bar"
ARGF.close
# 2つのファイルを開いていたので2度目のARGF.closeで全てのファイルを閉じたためtrueになる
ARGF.closed? # => true
@see IO#closed?, ARGF.class#close... -
Kernel
$ $ stdin -> object (20.0) -
標準入力です。
...d, fileno, to_io, eof, each_line, each_byte,
binmode, closed?
//emlist[例][ruby]{
$stdin = Object.new
def $stdin.gets
"foo"
end
p gets() # => "foo"
//}
自プロセスだけでなく、子プロセスの標準入力もリダイレクトしたいときは
以下のように IO#reopen を使...