Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure "Unknown handle" #4973

Closed
vicuna opened this issue Feb 5, 2010 · 3 comments
Closed

Failure "Unknown handle" #4973

vicuna opened this issue Feb 5, 2010 · 3 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Feb 5, 2010

Original bug ID: 4973
Reporter: Christoph Bauer
Assigned to: gildor
Status: closed (set by @xavierleroy on 2012-03-24T14:01:02Z)
Resolution: fixed
Priority: normal
Severity: tweak
Version: 3.11.0
Fixed in version: 3.12.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

Only Windows is affected.

I open a process and call select on stdin/stdout pipes. If the
process terminates on Unix, I get an Unix_error exception (Broken
pipe). Under windows I get 'Failure "Unknown handle"`. This comes
from select.c. It would be nice to have also a Unix_error, because
it reduces the number of portability problems.

@vicuna
Copy link
Author

vicuna commented May 20, 2010

Comment author: gildor

I think you mean the contrary, when testing I get:

  • a Sys_error("Bad file descriptor") on Linux
  • a Broken pipe on Windows

let dummy_exec =
Compile.compile_one_liner "dummy" [] ""
in
let (chn_in, chn_out) as proc =
open_process dummy_exec
in
let _s : process_status =
close_process proc
in
select
[descr_of_in_channel chn_in]
[descr_of_out_channel chn_out]
[]
1.0

Is this what you mean ?

@vicuna
Copy link
Author

vicuna commented May 20, 2010

Comment author: gildor

Check a little further, Sys_error("Bad file descriptor") | EPIPE is raised by descr_of_in_channel/descr_of_out_channel.

If I rework the program in this way:
let dummy_exec =
Compile.compile_one_liner "dummy" [] ""
in
let (chn_in, chn_out) as proc =
open_process dummy_exec
in
let fd_in =
descr_of_in_channel chn_in
in
let fd_out =
descr_of_out_channel chn_out
in
let _s : process_status =
close_process proc
in
select
[fd_in]
[fd_out]
[]
1.0

I get:

  • Unix.Unix_error(3, "select", "") on Linux
  • Failure("Unknown handle") on Windows

@vicuna
Copy link
Author

vicuna commented May 25, 2010

Comment author: gildor

Be consistent between Windows and Linux, raise an EBADF Unix_error for a closed pipe handle.

@vicuna vicuna closed this as completed Mar 24, 2012
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant