This can't be a feature... stdio should flush on exit!
% ruby -e 'printf "hello"'
% ruby -e 'printf "hello\n"'
hello
% ruby -e 'printf "hello";puts "hi";'
hellohi
%
Sam
This can't be a feature... stdio should flush on exit!
% ruby -e 'printf "hello"'
% ruby -e 'printf "hello\n"'
hello
% ruby -e 'printf "hello";puts "hi";'
hellohi
%
Sam
In the first example, your shell is overwriting the output.
Not a bug.
On Thu, 17 Mar 2005 10:34:47 +0900, Sam Roberts <sroberts@uniserve.com> wrote:
This can't be a feature... stdio should flush on exit!
% ruby -e 'printf "hello"'
% ruby -e 'printf "hello\n"'
hello
% ruby -e 'printf "hello";puts "hi";'
hellohi
%
Sam Roberts <sroberts@uniserve.com> writes:
This can't be a feature... stdio should flush on exit!
% ruby -e 'printf "hello"'
% ruby -e 'printf "hello\n"'
hello
% ruby -e 'printf "hello";puts "hi";'
hellohi
%
It does flush. Try doing this:
% ruby -e 'printf "hello"'; echo ''
hello
What's going on is that your shell is overwriting the "hello" that
indeed gets written on the next line, when it repositions the cursor to
the left column. Adding the "; echo ''" to the end shows that this is
taking place.
--
Lloyd Zusman
ljz@asfast.com
God bless you.
Quoting aredridel@gmail.com, on Thu, Mar 17, 2005 at 10:38:26AM +0900:
> This can't be a feature... stdio should flush on exit!
>
> % ruby -e 'printf "hello"'
> % ruby -e 'printf "hello\n"'
> hello
> % ruby -e 'printf "hello";puts "hi";'
> hellohi
> %In the first example, your shell is overwriting the output.
You're right, thanks!
And I'm pretty surprised.
Not a bug.
I think it is - a bug in zsh.
start with bash:
[ensemble] ~/p/ruby/zeroconf $ ruby -e 'print "hello"'
hello[ensemble] ~/p/ruby/zeroconf $ zsh
ensemble% ruby -e 'printf "hello"'
ensemble%
I think zsh is wrong here..
Cheers,
Sam
On Thu, 17 Mar 2005 10:34:47 +0900, Sam Roberts <sroberts@uniserve.com> wrote:
Also, check out
setopt nopromptcr
in the zsh docs.
hal:~% setopt promptcr # default
hal:~% echo -n hi
hal:~% setopt nopromptcr
hal:~% echo -n hi
hihal:~%
--
Jos Backus
jos at catnook.com
How did you diagnose his problem, out of curiosity?
Cheers,
Navin.
Aredridel <aredridel@gmail.com> wrote:
> This can't be a feature... stdio should flush on exit!
>
> % ruby -e 'printf "hello"'
> % ruby -e 'printf "hello\n"'
> hello
> % ruby -e 'printf "hello";puts "hi";'
> hellohi
> %In the first example, your shell is overwriting the output.
Not a bug.
Quoting jos@catnook.com, on Thu, Mar 17, 2005 at 11:35:01AM +0900:
Also, check out
setopt nopromptcr
in the zsh docs.
Great! zsh hasn't let me down until now, I'm glad I can fix this.
Sam
hal:~% setopt promptcr # default
hal:~% echo -n hi
hal:~% setopt nopromptcr
hal:~% echo -n hi
hihal:~%--
Jos Backus
jos at catnook.com
Hi,
In message "Re: bug? ruby doesn't flush stdio on exit!" on Thu, 17 Mar 2005 11:45:08 +0900, Navindra Umanee <navindra@cs.mcgill.ca> writes:
In the first example, your shell is overwriting the output.
Not a bug.How did you diagnose his problem, out of curiosity?
I guess he had same experience, like myself.
matz.
"Sam Roberts" <sroberts@uniserve.com> schrieb im Newsbeitrag
news:20050317014259.GA908@ensemble.local...
Quoting aredridel@gmail.com, on Thu, Mar 17, 2005 at 10:38:26AM +0900:
> > This can't be a feature... stdio should flush on exit!
> >
> > % ruby -e 'printf "hello"'
> > % ruby -e 'printf "hello\n"'
> > hello
> > % ruby -e 'printf "hello";puts "hi";'
> > hellohi
> > %
>
> In the first example, your shell is overwriting the output.You're right, thanks!
And I'm pretty surprised.
> Not a bug.
I think it is - a bug in zsh.
start with bash:
[ensemble] ~/p/ruby/zeroconf $ ruby -e 'print "hello"'
hello[ensemble] ~/p/ruby/zeroconf $ zsh
ensemble% ruby -e 'printf "hello"'
ensemble%I think zsh is wrong here..
It's probably just the promt setting. If the prompt starts with a CR then
old content of the line is overwritten.
robert
> On Thu, 17 Mar 2005 10:34:47 +0900, Sam Roberts <sroberts@uniserve.com> wrote:
* Robert Klemme (Mar 17, 2005 10:10):
> I think it is - a bug in zsh.
>
> start with bash:
>
> [ensemble] ~/p/ruby/zeroconf $ ruby -e 'print "hello"'
> hello[ensemble] ~/p/ruby/zeroconf $ zsh
> ensemble% ruby -e 'printf "hello"'
> ensemble%
>
>
> I think zsh is wrong here..
Wow, amazing how everything is a bug. Bugs, bugs, bugs...Bugs
everywhere!
It's probably just the promt setting. If the prompt starts with a CR then
old content of the line is overwritten.
Precisely. Zsh must know where it begins printing the prompt (and its
absolute width) to know when it has reached the right end of the
terminal (so that it can do proper wrapping or shifting). There's a
promptcr module for Zsh that outputs a newline before printing the
prompt, thus output is never overwritten. It's not very good, though.
See http://rubyurl.com/InP9S for a discussion on an alternative solution
to using promptcr,
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
* Nikolai Weibull (Mar 17, 2005 10:25):
… There's a promptcr module for Zsh that outputs a newline before
printing the prompt, thus output is never overwritten. …
Actually, it's called promptnl, not promptcr; sorry,
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}