* [ruby-core:81015] [Ruby trunk Bug#13546] std steams are closed in Windows app.
[not found] <redmine.issue-13546.20170506224800@ruby-lang.org>
@ 2017-05-06 22:48 ` aepifanov
2017-05-07 3:33 ` [ruby-core:81017] [Ruby trunk Bug#13546][Feedback] " nobu
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: aepifanov @ 2017-05-06 22:48 UTC (permalink / raw
To: ruby-core
Issue #13546 has been reported by alex (Alex Epifanov).
----------------------------------------
Bug #13546: std steams are closed in Windows app.
https://bugs.ruby-lang.org/issues/13546
* Author: alex (Alex Epifanov)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.3.3
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
We are embedding Ruby VM into a windows app ( msvc2015 CRT ). VM fails to initialize in Init_IO with 'closed stream', when initing stdin, stdout and stderr. Debugging shows that fileno() call for stdin and stderr returns -2 value and it is not and error according to MSDN:
https://msdn.microsoft.com/en-us/en-en/library/zs6wbdhx.aspx
"If stdout or stderr is not associated with an output stream (for example, in a Windows application without a console window), the file descriptor returned is -2. In previous versions, the file descriptor returned was -1. This change allows applications to distinguish this condition from an error."
Applying following patch to rb_io_check_closed seems to resolve the issue:
#ifdef _WIN32
if ((fptr->fd < 0) && (fptr->fd != -2) ) {
#else
if (fptr->fd < 0) {
#endif
rb_raise(rb_eIOError, closed_stream);
}
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:81017] [Ruby trunk Bug#13546][Feedback] std steams are closed in Windows app.
[not found] <redmine.issue-13546.20170506224800@ruby-lang.org>
2017-05-06 22:48 ` [ruby-core:81015] [Ruby trunk Bug#13546] std steams are closed in Windows app aepifanov
@ 2017-05-07 3:33 ` nobu
2017-05-12 0:36 ` [ruby-core:81107] [Ruby trunk Bug#13546] " aepifanov
2017-05-12 7:33 ` [ruby-core:81122] [Ruby trunk Bug#13546][Rejected] " nobu
3 siblings, 0 replies; 4+ messages in thread
From: nobu @ 2017-05-07 3:33 UTC (permalink / raw
To: ruby-core
Issue #13546 has been updated by nobu (Nobuyoshi Nakada).
Description updated
Status changed from Open to Feedback
Do you call `ruby_sysinit`?
----------------------------------------
Bug #13546: std steams are closed in Windows app.
https://bugs.ruby-lang.org/issues/13546#change-64679
* Author: alex (Alex Epifanov)
* Status: Feedback
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.3.3
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
We are embedding Ruby VM into a windows app ( msvc2015 CRT ). VM fails to initialize in `Init_IO` with 'closed stream', when initing stdin, stdout and stderr. Debugging shows that `fileno()` call for stdin and stderr returns -2 value and it is not and error according to MSDN:
https://msdn.microsoft.com/en-us/en-en/library/zs6wbdhx.aspx
"If stdout or stderr is not associated with an output stream (for example, in a Windows application without a console window), the file descriptor returned is -2. In previous versions, the file descriptor returned was -1. This change allows applications to distinguish this condition from an error."
Applying following patch to `rb_io_check_closed` seems to resolve the issue:
```c
#ifdef _WIN32
if ((fptr->fd < 0) && (fptr->fd != -2) ) {
#else
if (fptr->fd < 0) {
#endif
rb_raise(rb_eIOError, closed_stream);
}
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:81107] [Ruby trunk Bug#13546] std steams are closed in Windows app.
[not found] <redmine.issue-13546.20170506224800@ruby-lang.org>
2017-05-06 22:48 ` [ruby-core:81015] [Ruby trunk Bug#13546] std steams are closed in Windows app aepifanov
2017-05-07 3:33 ` [ruby-core:81017] [Ruby trunk Bug#13546][Feedback] " nobu
@ 2017-05-12 0:36 ` aepifanov
2017-05-12 7:33 ` [ruby-core:81122] [Ruby trunk Bug#13546][Rejected] " nobu
3 siblings, 0 replies; 4+ messages in thread
From: aepifanov @ 2017-05-12 0:36 UTC (permalink / raw
To: ruby-core
Issue #13546 has been updated by alex (Alex Epifanov).
nobu (Nobuyoshi Nakada) wrote:
> Do you call `ruby_sysinit`?
Our initialization code looks like this:
~~~ c
RUBY_INIT_STACK;
ruby_init();
#if defined(WIN32)
rb_w32_sysinit(NULL,NULL);
#endif
~~~
----------------------------------------
Bug #13546: std steams are closed in Windows app.
https://bugs.ruby-lang.org/issues/13546#change-64757
* Author: alex (Alex Epifanov)
* Status: Feedback
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.3.3
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
We are embedding Ruby VM into a windows app ( msvc2015 CRT ). VM fails to initialize in `Init_IO` with 'closed stream', when initing stdin, stdout and stderr. Debugging shows that `fileno()` call for stdin and stderr returns -2 value and it is not and error according to MSDN:
https://msdn.microsoft.com/en-us/en-en/library/zs6wbdhx.aspx
"If stdout or stderr is not associated with an output stream (for example, in a Windows application without a console window), the file descriptor returned is -2. In previous versions, the file descriptor returned was -1. This change allows applications to distinguish this condition from an error."
Applying following patch to `rb_io_check_closed` seems to resolve the issue:
```c
#ifdef _WIN32
if ((fptr->fd < 0) && (fptr->fd != -2) ) {
#else
if (fptr->fd < 0) {
#endif
rb_raise(rb_eIOError, closed_stream);
}
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:81122] [Ruby trunk Bug#13546][Rejected] std steams are closed in Windows app.
[not found] <redmine.issue-13546.20170506224800@ruby-lang.org>
` (2 preceding siblings ...)
2017-05-12 0:36 ` [ruby-core:81107] [Ruby trunk Bug#13546] " aepifanov
@ 2017-05-12 7:33 ` nobu
3 siblings, 0 replies; 4+ messages in thread
From: nobu @ 2017-05-12 7:33 UTC (permalink / raw
To: ruby-core
Issue #13546 has been updated by nobu (Nobuyoshi Nakada).
Status changed from Feedback to Rejected
Where do you define `WIN32`?
Note that the predefined macro is `_WIN32`.
And the call to `rb_w32_sysinit` must be **before** `ruby_init`, and the arguments must **not** be `NULL`.
----------------------------------------
Bug #13546: std steams are closed in Windows app.
https://bugs.ruby-lang.org/issues/13546#change-64773
* Author: alex (Alex Epifanov)
* Status: Rejected
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.3.3
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
We are embedding Ruby VM into a windows app ( msvc2015 CRT ). VM fails to initialize in `Init_IO` with 'closed stream', when initing stdin, stdout and stderr. Debugging shows that `fileno()` call for stdin and stderr returns -2 value and it is not and error according to MSDN:
https://msdn.microsoft.com/en-us/en-en/library/zs6wbdhx.aspx
"If stdout or stderr is not associated with an output stream (for example, in a Windows application without a console window), the file descriptor returned is -2. In previous versions, the file descriptor returned was -1. This change allows applications to distinguish this condition from an error."
Applying following patch to `rb_io_check_closed` seems to resolve the issue:
```c
#ifdef _WIN32
if ((fptr->fd < 0) && (fptr->fd != -2) ) {
#else
if (fptr->fd < 0) {
#endif
rb_raise(rb_eIOError, closed_stream);
}
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-12 6:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-13546.20170506224800@ruby-lang.org>
2017-05-06 22:48 ` [ruby-core:81015] [Ruby trunk Bug#13546] std steams are closed in Windows app aepifanov
2017-05-07 3:33 ` [ruby-core:81017] [Ruby trunk Bug#13546][Feedback] " nobu
2017-05-12 0:36 ` [ruby-core:81107] [Ruby trunk Bug#13546] " aepifanov
2017-05-12 7:33 ` [ruby-core:81122] [Ruby trunk Bug#13546][Rejected] " nobu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).