$stdout.sync on windows

hi, i don’t know wether this was discussed before:

any .rbw file that contains the line
$stdout.sync = true
will exit abnormally if printed to $stdout (allthough it makes no sence)
(if executed by double click, not executed by SciTe).

it’s reproducable. - mr

Windows & Ruby versions ?

Is this ok ? (sst.rbw)

···

“meinrad.recheis” my.name.here@gmx.at wrote:

any .rbw file that contains the line
$stdout.sync = true
will exit abnormally if printed to $stdout (allthough it makes no sence)
(if executed by double click, not executed by SciTe).

it’s reproducable. - mr


$stdout.sync=true
3.times {|n| puts n; sleep 2}

Works for me on 98se
ruby 1.8.0 (2003-08-04) [i586-bccwin32]

daz

Hi,

···

At Thu, 7 Aug 2003 08:03:59 +0900, meinrad.recheis wrote:

any .rbw file that contains the line
$stdout.sync = true
will exit abnormally if printed to $stdout (allthough it makes no sence)
(if executed by double click, not executed by SciTe).

Perhaps, you would associate .rbw with rubyw.exe. rubyw.exe is
a window mode application, so that no stdout handle is opened.


Nobu Nakada

yes that may be the case. it s no problem for me. but it is not a good
behavior from rubyw.exe to exit without error message.

daz: my version: ruby 1.7.3; win 2000
and your script doesn t work for me!

···

On Thu, 7 Aug 2003 13:00:52 +0900, nobu.nokada@softhome.net wrote:

Hi,

At Thu, 7 Aug 2003 08:03:59 +0900, > meinrad.recheis wrote:

any .rbw file that contains the line
$stdout.sync = true
will exit abnormally if printed to $stdout (allthough it makes no sence)
(if executed by double click, not executed by SciTe).

Perhaps, you would associate .rbw with rubyw.exe. rubyw.exe is
a window mode application, so that no stdout handle is opened.

  • mr

I ran this script under 173 (failed) then 180 (OK):

#<SST.RBW>
Rver = “ruby %s (%s) [%s]\n” % [RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_PLATFORM]
File.open(, ‘w’) do |sst|
sst.puts(Rver)
sst.puts(“Start: %s” % [Time.now])
$stdout.sync=true
2.times {|n| puts n; sleep 1}
sst.puts(" End : %s" % [Time.now])
end
#</SST.RBW>

Run Box command 1

D:\ruby\bin\ruby173w.exe D:\RUBY\DFB\TEMP\SST.RBW

#<‘C:\TEMP\sst.txt’> (Output)
ruby 1.7.3 (2002-11-17) [i386-mswin32]
Start: Fri Aug 08 01:33:17 GMT Daylight Time 2003
#</>

No console appeared and it didn’t finish. (No End time)

···

“meinrad.recheis” my.name.here@gmx.at wrote:

daz: my version: ruby 1.7.3; win 2000
and your script doesn t work for me!

  • mr

=======================================================

Run Box command 2

D:\ruby\src_inst\bin\rubyw.exe D:\RUBY\DFB\TEMP\SST.RBW

#<‘C:\TEMP\sst.txt’> (Output)
ruby 1.8.0 (2003-08-04) [i586-bccwin32]
Start: Fri Aug 08 01:35:50 2003
End : Fri Aug 08 01:35:52 2003
#</>

Console appeared, ran OK.

Even using rubyw.exe, I expect to see a console when writing
to STDOUT. The usefulness is that, unlike with ruby.exe,
one isn’t opened automatically.
I believe this is contrasting behaviours of winmain{} and main{}
in C rather than of Ruby itself.

Any corrections will be welcome.

This shows that (if you are still in any doubt) upgrading to
Ruby180 is a good idea.

daz

Hi,

···

At Fri, 8 Aug 2003 10:27:34 +0900, daz wrote:

Even using rubyw.exe, I expect to see a console when writing
to STDOUT. The usefulness is that, unlike with ruby.exe,
one isn’t opened automatically.
I believe this is contrasting behaviours of winmain{} and main{}
in C rather than of Ruby itself.

Usa reports it seems to be due to the difference between mswin
and bccwin, rather than ruby versions. Furthermore, bccwin
version rubyw.exe opens a console by just starting.


Nobu Nakada

Euuhhh, hadn’t noticed that.
Ruby Development Environment (RDE) ensures that I never see a console
(using ruby or rubyw). If I did, I’d have been screaming :wink:

Thanks for the detail.

daz

···

nobu.nokada@softhome.net wrote:

Hi,

I believe this is contrasting behaviours of winmain{} and main{}
in C rather than of Ruby itself.

Usa reports it seems to be due to the difference between mswin
and bccwin, rather than ruby versions. Furthermore, bccwin
version rubyw.exe opens a console by just starting.


Nobu Nakada