diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-02 09:51:30 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-02 09:51:30 +0000 |
commit | 849cfc481e535c6b9f04ab496200644b7c8c939a (patch) | |
tree | 22273c9208b146b3e45a9afc3d493d7fb69ce5ea | |
parent | 543630ffa2ddf4617c5d0205032035e62c41ceaf (diff) | |
download | ruby-849cfc481e535c6b9f04ab496200644b7c8c939a.tar.gz ruby-849cfc481e535c6b9f04ab496200644b7c8c939a.tar.xz ruby-849cfc481e535c6b9f04ab496200644b7c8c939a.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@16754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | lib/un.rb | 27 | ||||
-rw-r--r-- | win32/Makefile.sub | 7 |
3 files changed, 41 insertions, 1 deletions
@@ -1,3 +1,11 @@ +Mon Jun 2 18:51:15 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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. + Mon Jun 2 16:26:17 2008 Akinori MUSHA <knu@iDaemons.org> * lib/delegate.rb (Delegator::MethodDelegation#respond_to): @@ -214,6 +214,33 @@ def touch 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. # # ruby -run -e help [COMMAND] diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 011292180..0faee2702 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -184,6 +184,7 @@ XCFLAGS = -DRUBY_EXPORT -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) -I$(srcdir) # Prevents VC++ 2005 (cl ver 14) warnings DEFS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE MANIFESTTOOL = mt -nologo +LDSHARED_0 = @$(MINIRUBY) -run -e wait_writable -- -n 10 $@ LDSHARED_1 = $(MANIFESTTOOL) -manifest $(@).manifest -outputresource:$(@);2 LDSHARED_2 = @$(RM) $(@:/=\).manifest !endif @@ -610,6 +611,7 @@ s,@RPATHFLAG@,,;t t s,@LIBARG@,%s.lib,;t t s,@LINK_SO@,$$(LDSHARED) -Fe$$(@) $$(OBJS) $$(LIBS) $$(LOCAL_LIBS) $$(DLDFLAGS) -implib:$$(*F:.so=)-$$(arch).lib -pdb:$$(*F:.so=)-$$(arch).pdb -def:$$(DEFFILE),;t t !if $(MSC_VER) >= 1400 +s,@LINK_SO@,@$$(RUBY) -run -e wait_writable -- -n 10 $$(@),;t t s,@LINK_SO@,$(MANIFESTTOOL) -manifest $$(@).manifest -outputresource:$$(@);2,;t t s,@LINK_SO@,@$$(RM) $$(@:/=\).manifest,;t t !endif @@ -639,7 +641,7 @@ s,@top_srcdir@,$(srcdir),;t t miniruby$(EXEEXT): @echo. $(LIBS) $(PURIFY) $(CC) $(MAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(LIBS) -Fe$@ $(LDFLAGS) - miniruby.exe -v + $(LDSHARED_0) $(LDSHARED_1) $(LDSHARED_2) @@ -647,6 +649,7 @@ miniruby$(EXEEXT): $(PROGRAM): $(MAINOBJ) $(LIBRUBY_SO) $(RUBY_INSTALL_NAME).res $(PURIFY) $(CC) $(MAINOBJ) $(RUBY_INSTALL_NAME).res \ $(OUTFLAG)$@ $(LIBRUBYARG) $(LDFLAGS) $(XLDFLAGS) + $(LDSHARED_0) $(LDSHARED_1) $(LDSHARED_2) !endif @@ -656,6 +659,7 @@ $(WPROGRAM): $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_SO) $(RUBYW_INSTALL_NAME).res $(PURIFY) $(CC) $(MAINOBJ) $(WINMAINOBJ) \ $(RUBYW_INSTALL_NAME).res $(OUTFLAG)$@ $(LIBRUBYARG) \ $(LDFLAGS) $(XLDFLAGS) -subsystem:Windows + $(LDSHARED_0) $(LDSHARED_1) $(LDSHARED_2) !endif @@ -672,6 +676,7 @@ $(LIBRUBY_SO): $(LIBRUBY_A) $(DLDOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res $(LDSHARED) $(MAINOBJ) $(DLDOBJS) $(LIBRUBY_A) \ $(RUBY_SO_NAME).res $(LIBS) -Fe$@ $(LDFLAGS) \ $(LIBRUBY_DLDFLAGS) + $(LDSHARED_0) $(LDSHARED_1) $(LDSHARED_2) |