Issue #13894 has been updated by MSP-Greg (Greg L).


I don't recall having this issue in my builds, but with the patch, I have quite a few warnings.  I could file a separate bug report.  Try:

```
ruby -v -rwin32ole -e "class Word ; end ; w = WIN32OLE.new('Word.Application') ; WIN32OLE.const_load(w, Word)"
```

----------------------------------------
Bug #13894: win32ole/test_word.rb sometimes not quit Word
https://bugs.ruby-lang.org/issues/13894#change-66628

* Author: h.shirosaki (Hiroshi Shirosaki)
* Status: Closed
* Priority: Normal
* Assignee: suke (Masaki Suketa)
* Target version: 
* ruby -v: ruby 2.5.0dev (2017-09-11 trunk 59829) [x64-mingw32]
* Backport: 2.2: REQUIRED, 2.3: REQUIRED, 2.4: REQUIRED
----------------------------------------
When I run test-all, Word does not quit sometimes and Word opens confirm dialog to save files.
I have to close Word manually.

I think that `w.quit(Word::WdDoNotSaveChanges)` may be better to quit word.

```patch
diff --git a/test/win32ole/test_word.rb b/test/win32ole/test_word.rb
index 03b0bcbdde..b1cdb273cc 100644
--- a/test/win32ole/test_word.rb
+++ b/test/win32ole/test_word.rb
@@ -8,17 +8,22 @@
 end
 require "test/unit"
 
+if defined?(WIN32OLE)
+  module Word; end
+end
+
 def word_installed?
   installed = false
   w = nil
   if defined?(WIN32OLE)
     begin
       w = WIN32OLE.new('Word.Application')
+      WIN32OLE.const_load(w, Word)
       installed = true
     rescue
     ensure
       if w
-        w.quit
+        w.quit(Word::WdDoNotSaveChanges)
         w = nil
       end
     end
@@ -59,7 +64,7 @@ def test_s_connect
 
       def teardown
         if @obj
-          @obj.quit
+          @obj.quit(Word::WdDoNotSaveChanges)
           @obj = nil
         end
       end
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>