ライブラリ
- ビルトイン (168)
- fileutils (36)
- pathname (36)
- shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - timeout (21)
- un (24)
クラス
- File (60)
-
File
:: Stat (24) - Pathname (36)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6)
キーワード
-
NEWS for Ruby 2
. 5 . 0 (8) - Stat (12)
- Win32ネイティブ版Rubyの互換性問題 (12)
- birthtime (12)
-
chmod
_ R (12) - commands (12)
- ctime (48)
-
executable
_ real? (12) - install (12)
- lchmod (24)
- readable? (12)
-
ruby 1
. 8 . 3 feature (12) - setgid? (12)
- setuid? (12)
- sticky? (12)
- timeout (21)
- un (12)
- writable? (12)
- セキュリティモデル (2)
検索結果
先頭5件
-
FileTest
. # setuid?(file) -> bool (12.0) -
ファイルが setuid(2) されている時に真を返 します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...ト file が既に close されていた場合に発生します。
//emlist[例][ruby]{
require 'fileutils'
IO.write("testfile", "")
FileUtils.chmod("u+s", "testfile")
FileTest.setuid?("testfile") # => true
FileUtils.chmod("u-s", "testfile")
FileTest.setuid?("testfile") # => false
//}... -
FileTest
. # writable?(file) -> bool (12.0) -
ファイルがカレントプロセスにより書き込み可能である時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...false を返します。
@param file ファイル名を表す文字列を指定します。
//emlist[例][ruby]{
IO.write("testfile", "test")
File.chmod(0600, "testfile")
FileTest.writable?("testfile") # => true
File.chmod(0400, "testfile")
FileTest.writable?("testfile") # => false
//}... -
セキュリティモデル (12.0)
-
セキュリティモデル RubyにはCGI等のプログラミングを安全に行うことを助ける為に、セキュリティ 機構が備わっています。
...に加え、以下の操作が禁止されます。
* Dir.chdir Dir.chroot Dir.mkdir Dir.rmdir
* File.chown File.chmod File.umask File.truncate
File#lstat File#chmod File#chown File.delete File.unlink
File#truncate File#flock
および FileTest モジュールのメソッド... -
File
:: Stat (6.0) -
ファイルの情報を格納したオブジェクトのクラス。
...I/Oのブロックサイズ
blocks 割り当てられているブロック数
atime 最終アクセス時刻
mtime 最終更新時刻
ctime 最終状態変更時刻(状態の変更とは chmod などによるもので、Unix では i-node の変更を意味します)... -
File
:: Stat # birthtime -> Time (6.0) -
作成された時刻を返します。
...irthtime のない環境で発生します。
//emlist[][ruby]{
File.write("testfile", "foo")
sleep 10
File.write("testfile", "bar")
sleep 10
File.chmod(0644, "testfile")
sleep 10
File.read("testfile")
File.stat("testfile").birthtime #=> 2014-02-24 11:19:17 +0900
File.stat("testfile").mtime... -
FileUtils
. commands -> Array (6.0) -
何らかのオプションを持つメソッド名の配列を返します。
...何らかのオプションを持つメソッド名の配列を返します。
//emlist[][ruby]{
require 'fileutils'
FileUtils.commands # => ["chmod", "cp", "cp_r", "install", ...]
//}... -
Kernel
# install -> () (6.0) -
ファイルをコピーし、その属性を設定します。
...性を設定します。
ruby -run -e install -- [OPTION] SOURCE DEST
-p ファイルのアクセス時刻と修正時刻を保持します。
-m chmod と同じようにファイルのパーミッションを設定します。
-v 詳細表示
@see install(1)... -
NEWS for Ruby 2
. 5 . 0 (6.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...e?, File.writable_real?,
File.executable?, File.executable_real?, File.mkfifo, File.readlink,
File.truncate, File#truncate, File.chmod, File.lchmod, File.chown,
File.lchown, File.unlink, File.utime, File.lstat はGVLを解放するようになりました
* File.lutime を追... -
Pathname
# ctime -> Time (6.0) -
File.ctime(self.to_s) を渡したものと同じです。
....ctime(self.to_s) を渡したものと同じです。
//emlist[例][ruby]{
require 'pathname'
IO.write("testfile", "test")
pathname = Pathname("testfile")
pathname.ctime # => 2019-01-14 00:39:51 +0900
sleep 1
pathname.chmod(0755)
pathname.ctime # => 2019-01-14 00:39:52 +0900
//}
@see File.ctime... -
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (6.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...;$x^2+$y^2 < 1.0" | bc)
echo $x $y $c
if [ $c -eq 1 ]
then
let m1++
else
let m2++
fi
done
SHELL_EOT
}
File.chmod(0755, "loop.sh")
t = 10 # 10 秒でタイムアウト
begin
pid = nil
com = nil
Timeout.timeout(t) {
# system だととま...