nysol 3.0.0-universal-darwin-13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/blueKiller.rb +17 -0
- data/bin/mdistcopy.rb +89 -0
- data/bin/meach.rb +284 -0
- data/bin/meachc.rb +288 -0
- data/bin/msend.rb +95 -0
- data/bin/mtempclean.rb +33 -0
- data/ext/mcsvin/extconf.rb +15 -0
- data/ext/mcsvout/extconf.rb +14 -0
- data/ext/mmethods/extconf.rb +12 -0
- data/ext/mtable/extconf.rb +12 -0
- data/lib/nysol/margs.rb +402 -0
- data/lib/nysol/mcmd.rb +44 -0
- data/lib/nysol/mcsvin.bundle +0 -0
- data/lib/nysol/mcsvout.bundle +0 -0
- data/lib/nysol/mmethods.bundle +0 -0
- data/lib/nysol/mnettools.rb +220 -0
- data/lib/nysol/mparallel.rb +359 -0
- data/lib/nysol/mparallelmanager.rb +300 -0
- data/lib/nysol/mrubyparse.rb +538 -0
- data/lib/nysol/msysteminfo.rb +216 -0
- data/lib/nysol/mtable.bundle +0 -0
- data/lib/nysol/mtemp.rb +268 -0
- data/lib/nysol/mutils.rb +218 -0
- metadata +131 -0
@@ -0,0 +1,216 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
#/* ////////// LICENSE INFO ////////////////////
|
4
|
+
#
|
5
|
+
# * Copyright (C) 2013 by NYSOL CORPORATION
|
6
|
+
# *
|
7
|
+
# * Unless you have received this program directly from NYSOL pursuant
|
8
|
+
# * to the terms of a commercial license agreement with NYSOL, then
|
9
|
+
# * this program is licensed to you under the terms of the GNU Affero General
|
10
|
+
# * Public License (AGPL) as published by the Free Software Foundation,
|
11
|
+
# * either version 3 of the License, or (at your option) any later version.
|
12
|
+
# *
|
13
|
+
# * This program is distributed in the hope that it will be useful, but
|
14
|
+
# * WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF
|
15
|
+
# * NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
16
|
+
# *
|
17
|
+
# * Please refer to the AGPL (http://www.gnu.org/licenses/agpl-3.0.txt)
|
18
|
+
# * for more details.
|
19
|
+
#
|
20
|
+
# ////////// LICENSE INFO ////////////////////*/
|
21
|
+
require 'rubygems'
|
22
|
+
require 'set'
|
23
|
+
|
24
|
+
|
25
|
+
#==========================================================
|
26
|
+
# vm_stat output
|
27
|
+
#==========================================================
|
28
|
+
# Mach Virtual Memory Statistics: (page size of 4096 bytes)
|
29
|
+
# Pages free: 640719.
|
30
|
+
# Pages active: 550274.
|
31
|
+
# Pages inactive: 246385.
|
32
|
+
# Pages speculative: 140973.
|
33
|
+
# Pages throttled: 0.
|
34
|
+
# Pages wired down: 518097.
|
35
|
+
# Pages purgeable: 32227.
|
36
|
+
# "Translation faults": 5375781.
|
37
|
+
# Pages copy-on-write: 220656.
|
38
|
+
# Pages zero filled: 3602918.
|
39
|
+
# Pages reactivated: 2.
|
40
|
+
# Pages purged: 0.
|
41
|
+
# File-backed pages: 350402.
|
42
|
+
# Anonymous pages: 587230.
|
43
|
+
# Pages stored in compressor: 0.
|
44
|
+
# Pages occupied by compressor: 0.
|
45
|
+
# Decompressions: 0.
|
46
|
+
# Compressions: 0.
|
47
|
+
# Pageins: 138994.
|
48
|
+
# Pageouts: 0.
|
49
|
+
# Swapins: 0.
|
50
|
+
# Swapouts: 0.
|
51
|
+
#==========================================================
|
52
|
+
# Pages freeの行をメモリ空きとする
|
53
|
+
#==========================================================
|
54
|
+
module MCMD
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
module SysInfo
|
59
|
+
def self.ostype
|
60
|
+
if RUBY_PLATFORM.match(/darwin/) then
|
61
|
+
return "Darwin"
|
62
|
+
else
|
63
|
+
return "Linux"
|
64
|
+
end
|
65
|
+
return nil
|
66
|
+
end
|
67
|
+
|
68
|
+
#mac用トータルメモリ情報取得
|
69
|
+
def self.ttlMemoryOnOSX
|
70
|
+
return `sysctl hw.memsize`.split[-1]
|
71
|
+
end
|
72
|
+
def self.rstMemoryOnOSX
|
73
|
+
rmem = `vm_stat | grep "^Pages free"`.gsub(/\.$/,"").split[-1]
|
74
|
+
rmem = rmem.to_f * 4096 if rmem != nil
|
75
|
+
return rmem
|
76
|
+
end
|
77
|
+
|
78
|
+
#mac用トータルメモリ情報取得
|
79
|
+
def self.ttlRstMemoryOnLinux
|
80
|
+
memi = `free | grep "^Mem"`.split
|
81
|
+
return memi[1],memi[3]
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.memoryInfoOnOSX
|
85
|
+
return ttlMemoryOnOSX,rstMemoryOnOSX
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.memoryInfoOnLinux
|
89
|
+
return ttlRstMemoryOnLinux
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.getMemoryInfo
|
93
|
+
if ostype == "Darwin" then
|
94
|
+
return memoryInfoOnOSX
|
95
|
+
else
|
96
|
+
return memoryInfoOnLinux
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.restMemoryRate
|
101
|
+
ttlmem,rstmem = getMemoryInfo
|
102
|
+
if ttlmem != nil and rstmem != nil then
|
103
|
+
return rstmem.to_f * 100.0 / ttlmem.to_f
|
104
|
+
end
|
105
|
+
return nil
|
106
|
+
end
|
107
|
+
|
108
|
+
#=======================================================
|
109
|
+
def self.idleCPUOnOSX(priod=1)
|
110
|
+
# sar output
|
111
|
+
# 11:05:15 %usr %nice %sys %idle
|
112
|
+
# 11:05:16 2 0 1 96
|
113
|
+
# Average: 2 0 1 96
|
114
|
+
sar_sp = `sar -u #{priod} 1 | grep ^Average`.split
|
115
|
+
return sar_sp[4].to_f
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.idleCPUOnLinux(priod=1)
|
119
|
+
# procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
|
120
|
+
# r b swpd free buff cache si so bi bo in cs us sy id wa st
|
121
|
+
# 4 0 0 591720 98804 699532 0 0 71 13 46 855 9 0 91 0 0
|
122
|
+
# 0 0 0 591712 98804 699532 0 0 0 0 40 739 6 2 92 0 0
|
123
|
+
vstat_sp = `vmstat #{priod} 2 | tail -n 1 `.split
|
124
|
+
return vstat_sp[-3].to_f
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.idleCPU
|
128
|
+
if ostype == "Darwin" then
|
129
|
+
return idleCPUOnOSX
|
130
|
+
else
|
131
|
+
return idleCPUOnLinux
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def self.usedMemorybyPID
|
136
|
+
rtn = []
|
137
|
+
`ps -p #{pid} -o pid,%cpu,%mem,vsz,rss,time`.split("\n").each{|lstr|
|
138
|
+
vals = lstr.split("\s")
|
139
|
+
next if vals[0] == "PID"
|
140
|
+
rtn << vals[4].to_f * 0.001
|
141
|
+
tm = vals[5].split(":")
|
142
|
+
rtn << tm[0].to_i * 60 + tm[1].to_f
|
143
|
+
}
|
144
|
+
return rtn
|
145
|
+
end
|
146
|
+
|
147
|
+
def self.LimitOver_Mem_Cpu?(limM=5,limC=5)
|
148
|
+
memR = restMemoryRate
|
149
|
+
cpuR = idleCPU
|
150
|
+
return ( memR != nil and cpuR != nil and ( memR < limM or cpuR < limC ) )
|
151
|
+
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
#=======================================================
|
156
|
+
def self.cPIDsOnOSX(pid)
|
157
|
+
rls =[pid]
|
158
|
+
pids =[pid]
|
159
|
+
loop {
|
160
|
+
rtn =[]
|
161
|
+
pidset = Set.new(pids)
|
162
|
+
`ps o pid,ppid | grep "#{pids.join("\|")}"`.split("\n").each{|lstr|
|
163
|
+
vals = lstr.split("\s")
|
164
|
+
ppid = vals[1].to_i
|
165
|
+
if pidset.include?(ppid) then
|
166
|
+
rtn << vals[0].to_i
|
167
|
+
end
|
168
|
+
}
|
169
|
+
rls.concat(rtn)
|
170
|
+
pids = rtn
|
171
|
+
break if pids.empty?
|
172
|
+
}
|
173
|
+
return rls
|
174
|
+
end
|
175
|
+
def self.cPIDsOnLinux(pid)
|
176
|
+
rls =[pid]
|
177
|
+
return rls
|
178
|
+
end
|
179
|
+
|
180
|
+
def self.cPIDs(pid)
|
181
|
+
if ostype == "Darwin" then
|
182
|
+
return cPIDsOnOSX(pid)
|
183
|
+
else
|
184
|
+
return cPIDsOnOSX(pid)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
#=======================================================
|
189
|
+
def self.getMyIPOnOSX
|
190
|
+
`ifconfig en0 | grep "inet "`.split[1]
|
191
|
+
end
|
192
|
+
def self.getMyIPOnLinux
|
193
|
+
rls = `ifconfig eth0 | grep "inet "`.split[1]
|
194
|
+
rls.gsub!(/addr:/,"") if rls
|
195
|
+
return rls
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
def self.getMyIP
|
200
|
+
if ostype == "Darwin" then
|
201
|
+
return getMyIPOnOSX
|
202
|
+
else
|
203
|
+
return getMyIPOnLinux
|
204
|
+
end
|
205
|
+
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
if __FILE__ == $0 then
|
212
|
+
p MCMD::SysInfo.ostype
|
213
|
+
p MCMD::SysInfo.restMemoryRate
|
214
|
+
p MCMD::SysInfo.idleCPU
|
215
|
+
p MCMD::SysInfo.cPIDs(75932)
|
216
|
+
end
|
Binary file
|
data/lib/nysol/mtemp.rb
ADDED
@@ -0,0 +1,268 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
#/* ////////// LICENSE INFO ////////////////////
|
4
|
+
#
|
5
|
+
# * Copyright (C) 2013 by NYSOL CORPORATION
|
6
|
+
# *
|
7
|
+
# * Unless you have received this program directly from NYSOL pursuant
|
8
|
+
# * to the terms of a commercial license agreement with NYSOL, then
|
9
|
+
# * this program is licensed to you under the terms of the GNU Affero General
|
10
|
+
# * Public License (AGPL) as published by the Free Software Foundation,
|
11
|
+
# * either version 3 of the License, or (at your option) any later version.
|
12
|
+
# *
|
13
|
+
# * This program is distributed in the hope that it will be useful, but
|
14
|
+
# * WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF
|
15
|
+
# * NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
16
|
+
# *
|
17
|
+
# * Please refer to the AGPL (http://www.gnu.org/licenses/agpl-3.0.txt)
|
18
|
+
# * for more details.
|
19
|
+
#
|
20
|
+
# ////////// LICENSE INFO ////////////////////*/
|
21
|
+
|
22
|
+
module MCMD
|
23
|
+
|
24
|
+
#= 一時ファイル名を扱うクラス
|
25
|
+
#
|
26
|
+
# 一時ファイル名の生成と、そのファイルの(自動)削除を行うクラス*。
|
27
|
+
# 一時ファイル名はfileもしくはpipeメソッドを呼び出すたびに重複なく生成される。
|
28
|
+
# fileメソッドでは、ファイル名が生成するだけで、実ファイルは生成されない。
|
29
|
+
# 一方でpipeメソッドでは、mkfifoコマンドにより名前付きパイプファイルが生成される。
|
30
|
+
#
|
31
|
+
# 一時ファイル名の命名規則は以下の通り。
|
32
|
+
# "#{@path}/__MTEMP_#{@pid}_#{@oid}_#{@seq}"
|
33
|
+
#
|
34
|
+
# @pid : プロセスID ($$)
|
35
|
+
# @oid : オブジェクトID (self.object_id)
|
36
|
+
# @seq : オブジェクト内の通し番号 (自動採番で1から始まる)
|
37
|
+
# @path : 以下の優先順位で決まる。
|
38
|
+
# 1) Mtemp.newの第1引数で指定された値*
|
39
|
+
# 2) KG_TmpPath環境変数の値
|
40
|
+
# 3) TMP環境変数の値
|
41
|
+
# 4) TEMP環境変数の値
|
42
|
+
# 5) "/tmp"
|
43
|
+
# 6) "." (カレントパス)
|
44
|
+
#
|
45
|
+
# 注*) new第1引数でパス名を明示的に指定した場合、GC時に自動削除されない。
|
46
|
+
#
|
47
|
+
#=== メソッド:
|
48
|
+
# file : 一時ファイル名を返す
|
49
|
+
# path : 一時ファイル名を格納するパスを返す
|
50
|
+
# rm : 実行時点までに生成した一時ファイルを全て削除する。
|
51
|
+
#
|
52
|
+
#=== 例1
|
53
|
+
# 基本利用例
|
54
|
+
# ------------------------------------------------------
|
55
|
+
# require 'mtools'
|
56
|
+
#
|
57
|
+
# tmp=MCMD::Mtemp.new
|
58
|
+
# fName1=tmp.file
|
59
|
+
# fName2=tmp.file
|
60
|
+
# fName3=tmp.file("./xxa")
|
61
|
+
# puts fName1 # -> /tmp/__MTEMP_60637_2152301760_0
|
62
|
+
# puts fName2 # -> /tmp/__MTEMP_60637_2152301760_1
|
63
|
+
# puts fName3 # -> ./xxa
|
64
|
+
# File.open(fName1,"w"){|fp| fp.puts "temp1"}
|
65
|
+
# File.open(fName2,"w"){|fp| fp.puts "temp2"}
|
66
|
+
# File.open(fName3,"w"){|fp| fp.puts "temp3"}
|
67
|
+
# # tmpがローカルのスコープを外れると
|
68
|
+
# # GCが発動するタイミングで一時ファイルも自動的に削除される。
|
69
|
+
# # ただし、fName3は一時ファイル名を直接指定しているの削除されない。
|
70
|
+
# ------------------------------------------------------
|
71
|
+
#
|
72
|
+
#===例2:
|
73
|
+
# 全ての一時ファイルが自動削除されない例
|
74
|
+
# ------------------------------------------------------
|
75
|
+
# require 'mtools'
|
76
|
+
#
|
77
|
+
# # コンストラクタでパスを指定すると自動削除されない。
|
78
|
+
# # (rmメソッドにより削除することはできる。)
|
79
|
+
# tmp=MCMD::Mtemp.new(".")
|
80
|
+
# fName=tmp.file
|
81
|
+
# File.open(fName,"w"){|fp| fp.puts "temp"}
|
82
|
+
# # tmpがローカルのスコープを外れGCが発動しても
|
83
|
+
# # 一時ファイルは削除されない。
|
84
|
+
# ------------------------------------------------------
|
85
|
+
#
|
86
|
+
#=== 例3:
|
87
|
+
# 名前付きパイプ名の生成
|
88
|
+
# ------------------------------------------------------
|
89
|
+
# require 'mtools'
|
90
|
+
#
|
91
|
+
# tmp=MCMD::Mtemp.new
|
92
|
+
# pName=tmp.pipe
|
93
|
+
# system("ls -l #{pName}") # この段階で名前付きパイプファイルが作成されている。
|
94
|
+
# -> prw-r--r-- 1 user group 0 7 19 12:20 /tmp/__MTEMP_60903_2152299720_0
|
95
|
+
# system("echo 'abc' > #{pName} &") # バックグラウンド実行でnamed pipeに書き込み
|
96
|
+
# system("cat <#{pName} &") # バックグラウンド実行でnamed pipeから読み込み
|
97
|
+
# # tmpがローカルのスコープを外れると
|
98
|
+
# # GCが発動するタイミングで全ての一時ファイルは自動削除される。
|
99
|
+
# ------------------------------------------------------
|
100
|
+
class Mtemp
|
101
|
+
private
|
102
|
+
|
103
|
+
# ワークファイルを全て消す
|
104
|
+
def delAllFiles(path,pid,oid)
|
105
|
+
if @pid == $$.to_s and @oid == self.object_id then
|
106
|
+
Dir["#{path}/__MTEMP_#{@pid}_#{@oid}_*"].each{|dn|
|
107
|
+
system "rm -rf #{dn}"
|
108
|
+
}
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
# デストラクタ呼び出し時にcallされる関数
|
114
|
+
class << self
|
115
|
+
def callback(path,pid,oid)
|
116
|
+
lambda {
|
117
|
+
delAllFiles(path,pid,oid)
|
118
|
+
}
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
#== コンストラクタ
|
123
|
+
# Mtempオブジェクトを生成する。
|
124
|
+
# path: 一時ファイルを格納するディレクトリパス名を指定する。
|
125
|
+
# pathを指定した場合、作成された一時ファイルはGC時に自動削除されない。
|
126
|
+
# pathの指定しなければ、環境変数に設定されたpath名等が利用され、GC時に自動削除される。
|
127
|
+
def initialize(path=nil)
|
128
|
+
@gcRM=true
|
129
|
+
if path
|
130
|
+
@path=path
|
131
|
+
@gcRM=false
|
132
|
+
elsif not ENV["KG_TmpPath"].nil? then
|
133
|
+
@path=ENV["KG_TmpPath"]
|
134
|
+
elsif not ENV["TMP"].nil? then
|
135
|
+
@path=ENV["TMP"]
|
136
|
+
elsif not ENV["TEMP"].nil? then
|
137
|
+
@path=ENV["TEMP"]
|
138
|
+
elsif File.writable?("/tmp") then
|
139
|
+
@path="/tmp"
|
140
|
+
elsif File.writable?(".") then
|
141
|
+
@path="."
|
142
|
+
else
|
143
|
+
raise("no writable temporal directory found")
|
144
|
+
end
|
145
|
+
|
146
|
+
@pid = $$.to_s
|
147
|
+
@oid = self.object_id
|
148
|
+
|
149
|
+
@seq = 0 # オブジェクト内通し連番
|
150
|
+
|
151
|
+
# GC呼び出し時にcallする関数を設定する。
|
152
|
+
@clean_proc=Mtemp.callback(@path,@pid,@oid)
|
153
|
+
ObjectSpace.define_finalizer(self, @clean_proc)
|
154
|
+
|
155
|
+
# ruby終了時にcallする関数を設定する。
|
156
|
+
if @gcRM
|
157
|
+
at_exit {
|
158
|
+
delAllFiles(@path,@pid,@oid)
|
159
|
+
}
|
160
|
+
end
|
161
|
+
|
162
|
+
return self
|
163
|
+
end
|
164
|
+
|
165
|
+
def mkname
|
166
|
+
return "#{@path}/__MTEMP_#{@pid}_#{@oid}_#{@seq}"
|
167
|
+
end
|
168
|
+
|
169
|
+
public
|
170
|
+
|
171
|
+
#== 一時ファイル名の取得
|
172
|
+
# 返値: 一時ファイル名(String)
|
173
|
+
#
|
174
|
+
# 以下のフォーマットで一時ファイル名を生成する。
|
175
|
+
# @seqはカウントアップされる。
|
176
|
+
# フォーマット: "#{@path}/__MTEMP_#{@pid}_#{@oid}_#{@seq}"
|
177
|
+
# nameが指定されれば(@path以外に)GCで削除しなくなる。
|
178
|
+
def file(name=nil)
|
179
|
+
# ファイル名の生成
|
180
|
+
n=nil
|
181
|
+
if name==nil then
|
182
|
+
n="#{mkname}"
|
183
|
+
@seq += 1
|
184
|
+
else
|
185
|
+
n=name
|
186
|
+
end
|
187
|
+
return n
|
188
|
+
end
|
189
|
+
|
190
|
+
#== 一時ファイル名(名前付きパイプ)の取得
|
191
|
+
# 返値: 一時ファイル名(String)
|
192
|
+
#
|
193
|
+
# 以下のフォーマットで名前付きパイプの一時ファイル名を生成する。
|
194
|
+
# @seqはカウントアップされる。
|
195
|
+
# フォーマット: "#{@path}/__MTEMP_#{@pid}_#{@oid}_#{@seq}"
|
196
|
+
# nameが指定されれば(@path以外に)GCで削除しなくなる。
|
197
|
+
def pipe(name=nil)
|
198
|
+
# ファイル名の生成
|
199
|
+
n=nil
|
200
|
+
if name==nil then
|
201
|
+
n="#{mkname}"
|
202
|
+
@seq += 1
|
203
|
+
else
|
204
|
+
n=name
|
205
|
+
end
|
206
|
+
|
207
|
+
# fifoファイル(名前付きパイプ)の作成
|
208
|
+
system "mkfifo #{n}"
|
209
|
+
|
210
|
+
return n
|
211
|
+
end
|
212
|
+
|
213
|
+
#== 一時ファイルの出力パスの取得
|
214
|
+
# 返値: 一時ファイルを出力パス名(String)
|
215
|
+
def path
|
216
|
+
return @path
|
217
|
+
end
|
218
|
+
|
219
|
+
#=== 一時ファイルの削除
|
220
|
+
# 以下のコマンドを実行することで一時ファイルを全て削除する。
|
221
|
+
# system "rm -rf #{path}/__MTEMP_#{@pid}_#{@oid}_*"
|
222
|
+
def rm
|
223
|
+
delAllFiles(@path,@pid,@oid)
|
224
|
+
end
|
225
|
+
|
226
|
+
# ワークファイル強制削除#{path}
|
227
|
+
def forceDel(save=false)
|
228
|
+
Dir["#{@path}/__MTEMP_*"].each{|fn|
|
229
|
+
if save then
|
230
|
+
system("tar cvfzP #{fn}.tar.gz #{fn}")
|
231
|
+
end
|
232
|
+
system "rm -rf #{fn}"
|
233
|
+
}
|
234
|
+
end
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
end # class
|
239
|
+
end # module
|
240
|
+
|
241
|
+
#==============================================
|
242
|
+
#以下、サンプルコード(require時は実行されない)
|
243
|
+
#==============================================
|
244
|
+
if __FILE__ == $0
|
245
|
+
tmp=MCMD::Mtemp.new
|
246
|
+
fName1=tmp.file
|
247
|
+
fName2=tmp.file
|
248
|
+
fName3=tmp.file("./xxa")
|
249
|
+
puts fName1
|
250
|
+
puts fName2
|
251
|
+
puts fName3
|
252
|
+
File.open(fName1,"w"){|fp| fp.puts "temp1"}
|
253
|
+
File.open(fName2,"w"){|fp| fp.puts "temp2"}
|
254
|
+
File.open(fName3,"w"){|fp| fp.puts "temp3"}
|
255
|
+
|
256
|
+
tmp=MCMD::Mtemp.new(".")
|
257
|
+
fName=tmp.file
|
258
|
+
File.open(fName,"w"){|fp| fp.puts "temp"}
|
259
|
+
|
260
|
+
tmp=MCMD::Mtemp.new
|
261
|
+
pName=tmp.pipe
|
262
|
+
system("ls -l #{pName}")
|
263
|
+
system("echo 'abc' > #{pName} &")
|
264
|
+
system("cat <#{pName} &")
|
265
|
+
|
266
|
+
end # サンプルコード
|
267
|
+
#==============================================
|
268
|
+
|