From: nobu@... Date: 2016-07-19T09:07:21+00:00 Subject: [ruby-core:76438] [Ruby trunk Bug#12467][Third Party's Issue] Open mode 'a' does not work for Process.spawn on Windows Issue #12467 has been updated by Nobuyoshi Nakada. Description updated Status changed from Open to Third Party's Issue Windows does not provide append mode, but ruby emulates it. ---------------------------------------- Bug #12467: Open mode 'a' does not work for Process.spawn on Windows https://bugs.ruby-lang.org/issues/12467#change-59684 * Author: Yutaka HARA * Status: Third Party's Issue * Priority: Normal * Assignee: * ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- Example: ~~~ruby spawn 'ruby -e "p Time.now"', [:out, :err] => ['log.txt', 'a'] sleep 1 spawn 'ruby -e "p Time.now"', [:out, :err] => ['log.txt', 'a'] sleep 1 p File.read('log.txt') ~~~ This program looks work correctly at first. ~~~ c:\>ruby spawn_bug.rb "2016-06-07 18:47:25 +0900\n2016-06-07 18:28:17 +0900\n" ~~~ However, when I run it again, the log file is truncated like 'w' flag. ~~~ c:\>ruby spawn_bug.rb "2016-06-07 18:47:38 +0900\n2016-06-07 18:28:17 +0900\n" ~~~ This is the same if I open the log file manually with File.open. ~~~ruby f = File.open('log.txt', 'a') spawn 'ruby -e "p Time.now"', [:out, :err] => f sleep 1 spawn 'ruby -e "p Time.now"', [:out, :err] => f sleep 1 p File.read('log.txt') ~~~ I tried this on Windows 10. (Also confirmed this does not happen on Mac OS X 10.11 + ruby 2.2) -- https://bugs.ruby-lang.org/ Unsubscribe: