Project

General

Profile

Actions

Feature #7082

open

Process.kill 0 in windows can return spurious success

Added by rogerdpack (Roger Pack) about 12 years ago. Updated almost 7 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:47719]

Description

a = IO.popen('ls "."', 'w')
=> #<IO:fd 4>
a.pid
=> 2104
Process.kill 0, 2104
=> 1 # should raise an exception since that process is dead now, shouldn't it? [it can be checked with GetExitCodeProcess != STILL_ACTIVE) ?

Thanks!
-r

Updated by rogerdpack (Roger Pack) about 12 years ago

I see that the current way in windows somewhat mimic's how it operates in Unix (process is a zombie, so still responds to signals). If so, perhaps it would be nice to create a new method

Process.alive?(pid)

that would be useful in certain cases, like checking if a process is dead before closing streams to it.

So maybe change this to a feature request, if anybody can confirm the above.

Thanks.
-roger-

Updated by usa (Usaku NAKAMURA) about 12 years ago

  • Tracker changed from Bug to Feature

Updated by mame (Yusuke Endoh) about 12 years ago

  • Status changed from Open to Assigned
  • Assignee set to usa (Usaku NAKAMURA)
  • Target version set to 2.6

Updated by usa (Usaku NAKAMURA) about 7 years ago

  • Status changed from Assigned to Open
  • Assignee deleted (usa (Usaku NAKAMURA))

Updated by rrroybbbean (RRRoy BBBean) about 7 years ago

Sorry to jump in, but this might help.

In the past, I have had problems with the 'kill' command on Windows 7,
and I stopped using 'kill' on Windows over 4 years ago.

This problem with 'kill' was independent of Ruby. I found that 'kill'
did not (always/sometimes) work from the bash/cygwin command line. No
error. It just didn't work. I figured it was a just a windows thing.

I use the Windows Task Manager on Windows 7 to terminate processes
instead. It always works.

I only mention this because the problem raised may be caused by
underlying software libraries, and not Ruby.

On 10/21/2017 07:02 AM, wrote:

Issue #7082 has been updated by usa (Usaku NAKAMURA).

Status changed from Assigned to Open
Assignee deleted (usa (Usaku NAKAMURA))


Feature #7082: Process.kill 0 in windows can return spurious success
https://bugs.ruby-lang.org/issues/7082#change-67433

  • Author: rogerdpack (Roger Pack)
  • Status: Open
  • Priority: Normal
  • Assignee:
  • Target version: next minor

a = IO.popen('ls "."', 'w')
=> #<IO:fd 4>
a.pid
=> 2104
Process.kill 0, 2104
=> 1 # should raise an exception since that process is dead now, shouldn't it? [it can be checked with GetExitCodeProcess != STILL_ACTIVE) ?

Thanks!
-r

Actions #6

Updated by naruse (Yui NARUSE) almost 7 years ago

  • Target version deleted (2.6)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0