1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/un.rb (wait_writable): wait until target files can be

written actually.

	* win32/Makefile.sub (LDSHARED_0, LINK_SO): get rid of failure of
	  mt.exe.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-06-02 09:51:30 +00:00
parent c147806901
commit eaa3ffbae8
3 changed files with 41 additions and 1 deletions

View file

@ -213,6 +213,33 @@ def touch
end
end
##
# Wait until the file becomes writable.
#
# ruby -run -e wait_writable -- [OPTION] FILE
#
def wait_writable
setup("n:w:v") do |argv, options|
verbose = options[:verbose]
n = options[:n] and n = Integer(n)
wait = (wait = options[:w]) ? Float(wait) : 0.2
argv.each do |file|
begin
open(file, "r+b")
rescue Errno::ENOENT
break
rescue Errno::EACCES => e
raise if n and (n -= 1) <= 0
puts e
STDOUT.flush
sleep wait
retry
end
end
end
end
##
# Display help message.
#