Project

General

Profile

Actions

Bug #4518

closed

(win32) waitpid returns exit code while the child process still alive.

Added by arton (Akio Tajima) about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3dev (2011-03-22) [i386-mswin32_100]
Backport:
[ruby-dev:43344]

Description

=begin
以下のスクリプトを実行すると2~4回目の繰り返しでエラーとなります(test/test_process.rbから抽出して加工)。

coding: utf-8

require 'tmpdir'
require 'pathname'
def with_tmpchdir
Dir.mktmpdir {|d|
p d
d = Pathname.new(d).realpath.to_s
Dir.chdir(d) { yield d }
}
end
def write_file(filename, content)
File.open(filename, "w") {|f| f << content }
end
10.times do
with_tmpchdir do
write_file("foo", "sleep 0.1")
ps = (0...3).map { spawn("ruby", "foo") }.sort
ss = Process.waitall
end
end

エラー:
C:/Users/arton/Documents/ruby/src/rubytrunk/lib/fileutils.rb:1308:in rmdir': Permission denied - :/Users/arton/AppData/Local/Temp/d20110322-7200-dxjpnx (Errno::EACCES) from C:/Users/arton/Documents/ruby/src/rubytrunk/lib/fileutils.rb:1308:in block in remove_dir1'
...

WIN32APIのGetExitCodeProcessがアプリケーションの終了ステータスを返した時点では、まだプロセスが終了していないことがあるため、子プロセスがテンポラリディレクトリを利用していてEACCESとなるようです。
(実行環境が、4コア Xeonというのが利いているとは思います)
=end

Actions #1

Updated by arton (Akio Tajima) about 13 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r31152.
Akio, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Updated by arton (Akio Tajima) about 13 years ago

=begin
r31152で修正しました。
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0