summaryrefslogtreecommitdiff
path: root/lib/shell/builtin-command.rb
diff options
context:
space:
mode:
authorkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-20 12:38:58 +0000
committerkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-20 12:38:58 +0000
commit42a81120e510c2c2fb7822ff4d5738db6ba392bf (patch)
tree3f6024dcb1fe3a3ca6b3fd613f436fd99c80c80c /lib/shell/builtin-command.rb
parentd9d838a45beff13576e4fba42e0d5b611d0df706 (diff)
* lib/shell.rb, lib/shell: support for ruby 1.9(YARV) thread model.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/shell/builtin-command.rb')
-rw-r--r--lib/shell/builtin-command.rb31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/shell/builtin-command.rb b/lib/shell/builtin-command.rb
index db1adfa48b..cfdbc046aa 100644
--- a/lib/shell/builtin-command.rb
+++ b/lib/shell/builtin-command.rb
@@ -1,9 +1,9 @@
#
# shell/builtin-command.rb -
-# $Release Version: 0.6.0 $
+# $Release Version: 0.7 $
# $Revision$
# $Date$
-# by Keiju ISHITSUKA(Nihon Rational Software Co.,Ltd)
+# by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
@@ -22,6 +22,16 @@ class Shell
end
end
+ class Void < BuiltInCommand
+ def initialize(sh, *opts)
+ super sh
+ end
+
+ def each(rs = nil)
+ # do nothing
+ end
+ end
+
class Echo < BuiltInCommand
def initialize(sh, *strings)
super sh
@@ -58,20 +68,17 @@ class Shell
super sh
@pattern = pattern
- Thread.critical = true
- back = Dir.pwd
- begin
- Dir.chdir @shell.cwd
- @files = Dir[pattern]
- ensure
- Dir.chdir back
- Thread.critical = false
- end
end
def each(rs = nil)
+ if @pattern[0] == ?/
+ @files = Dir[@pattern]
+ else
+ prefix = @shell.pwd+"/"
+ @files = Dir[prefix+@pattern].collect{|p| p.sub(prefix, "")}
+ end
rs = @shell.record_separator unless rs
- for f in @files
+ for f in @files
yield f+rs
end
end