Writing on stdout when redirecting the standard output

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Writing on stdout when redirecting the standard output

fstephany

$ pharo Pharo-30852.image > /tmp/test.log

Outputting somethind to stdout results in:
"FileWriteError: File stdout is closed"

* Arch Linux
* Pharo 30852.

$ pharo --version

3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux


Did I miss something?

Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

LogiqueWerks
on linux I used to have a BASH shell "wrapping" script to address this redirect snaffu in a pinch with other interpreters ...

Does that "ring a bell" with someone as a quick work-around ? My memory can be such a pain and I am on an old XP laptop just now ... I am quite sure I had to launch from BASH ... within Bash


On 28 July 2014 11:46, François Stephany <[hidden email]> wrote:

$ pharo Pharo-30852.image > /tmp/test.log

Outputting somethind to stdout results in:
"FileWriteError: File stdout is closed"

* Arch Linux
* Pharo 30852.

$ pharo --version

3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux


Did I miss something?


Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

philippeback
In reply to this post by fstephany

Mmh, I have been experiencing that too.

Stdin and stdout aren't that well handled it seems. I write to the term using VTerm fwiw.

Phil

Le 28 juil. 2014 16:46, "François Stephany" <[hidden email]> a écrit :

$ pharo Pharo-30852.image > /tmp/test.log

Outputting somethind to stdout results in:
"FileWriteError: File stdout is closed"

* Arch Linux
* Pharo 30852.

$ pharo --version

3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux


Did I miss something?

Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

LogiqueWerks


On 28 July 2014 14:01, [hidden email] <[hidden email]> wrote:

Mmh, I have been experiencing that too.

Stdin and stdout aren't that well handled it seems. I write to the term using VTerm fwiw.

Phil

Le 28 juil. 2014 16:46, "François Stephany" <[hidden email]> a écrit :

$ pharo Pharo-30852.image > /tmp/test.log

Outputting somethind to stdout results in:
"FileWriteError: File stdout is closed"

* Arch Linux
* Pharo 30852.

$ pharo --version

3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux


Did I miss something?


Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

LogiqueWerks
In reply to this post by philippeback
ex Google on

"rlwrap" STDIN STDOUT redirection




On 28 July 2014 14:01, [hidden email] <[hidden email]> wrote:

Mmh, I have been experiencing that too.

Stdin and stdout aren't that well handled it seems. I write to the term using VTerm fwiw.

Phil

Le 28 juil. 2014 16:46, "François Stephany" <[hidden email]> a écrit :

$ pharo Pharo-30852.image > /tmp/test.log

Outputting somethind to stdout results in:
"FileWriteError: File stdout is closed"

* Arch Linux
* Pharo 30852.

$ pharo --version

3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux


Did I miss something?


Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

stepharo
In reply to this post by fstephany
Francois

can you open a bug entry because this is not nice.

Stef

On 28/7/14 16:46, François Stephany wrote:

$ pharo Pharo-30852.image > /tmp/test.log

Outputting somethind to stdout results in:
"FileWriteError: File stdout is closed"

* Arch Linux
* Pharo 30852.

$ pharo --version

3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux


Did I miss something?


Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

Sven Van Caekenberghe-2
I think we need a better bug report, for me (Mac OS X) this works fine:

$ ./pharo Pharo.image eval 'FileStream stdout nextPutAll: 42 factorial asString; cr. #done' > out.txt

$ cat out.txt
1405006117752879898543142606244511569936384000000000
#done

So, what exactly is not working ?

On 28 Jul 2014, at 21:30, stepharo <[hidden email]> wrote:

> Francois
>
> can you open a bug entry because this is not nice.
>
> Stef
>
> On 28/7/14 16:46, François Stephany wrote:
>>
>> $ pharo Pharo-30852.image > /tmp/test.log
>>
>> Outputting somethind to stdout results in:
>> "FileWriteError: File stdout is closed"
>>
>> * Arch Linux
>> * Pharo 30852.
>>
>> $ pharo --version
>>
>> 3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
>> NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
>> NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
>> https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
>> Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux
>>
>>
>> Did I miss something?
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

fstephany
Yes, it works for me on OSX.l But it says "FileWriteError: File stdout is closed" when doing exactly the same thing on the Arch Linux of one of our programmer.

We'll investigate and test on another Linux distro...


On Mon, Jul 28, 2014 at 10:50 PM, Sven Van Caekenberghe <[hidden email]> wrote:
I think we need a better bug report, for me (Mac OS X) this works fine:

$ ./pharo Pharo.image eval 'FileStream stdout nextPutAll: 42 factorial asString; cr. #done' > out.txt

$ cat out.txt
1405006117752879898543142606244511569936384000000000
#done

So, what exactly is not working ?

On 28 Jul 2014, at 21:30, stepharo <[hidden email]> wrote:

> Francois
>
> can you open a bug entry because this is not nice.
>
> Stef
>
> On 28/7/14 16:46, François Stephany wrote:
>>
>> $ pharo Pharo-30852.image > /tmp/test.log
>>
>> Outputting somethind to stdout results in:
>> "FileWriteError: File stdout is closed"
>>
>> * Arch Linux
>> * Pharo 30852.
>>
>> $ pharo --version
>>
>> 3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
>> NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
>> NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
>> https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
>> Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux
>>
>>
>> Did I miss something?
>>
>



Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

fstephany
Uh. We nailed it.

We implemented a custom Logger writing to stdout because the default one doesn't flush the stream immediately after writing to it.

One of our configuration was configuring a logger and another was reconfiguring it. The stdout stream was probably closed in the process somewhere.

In conclusion, beware of your loggers ;)



On Tue, Jul 29, 2014 at 8:32 AM, François Stephany <[hidden email]> wrote:
Yes, it works for me on OSX.l But it says "FileWriteError: File stdout is closed" when doing exactly the same thing on the Arch Linux of one of our programmer.

We'll investigate and test on another Linux distro...


On Mon, Jul 28, 2014 at 10:50 PM, Sven Van Caekenberghe <[hidden email]> wrote:
I think we need a better bug report, for me (Mac OS X) this works fine:

$ ./pharo Pharo.image eval 'FileStream stdout nextPutAll: 42 factorial asString; cr. #done' > out.txt

$ cat out.txt
1405006117752879898543142606244511569936384000000000
#done

So, what exactly is not working ?

On 28 Jul 2014, at 21:30, stepharo <[hidden email]> wrote:

> Francois
>
> can you open a bug entry because this is not nice.
>
> Stef
>
> On 28/7/14 16:46, François Stephany wrote:
>>
>> $ pharo Pharo-30852.image > /tmp/test.log
>>
>> Outputting somethind to stdout results in:
>> "FileWriteError: File stdout is closed"
>>
>> * Arch Linux
>> * Pharo 30852.
>>
>> $ pharo --version
>>
>> 3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
>> NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
>> NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
>> https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
>> Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux
>>
>>
>> Did I miss something?
>>
>




Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

Sven Van Caekenberghe-2

On 29 Jul 2014, at 09:49, François Stephany <[hidden email]> wrote:

> Uh. We nailed it.

Good !

> We implemented a custom Logger writing to stdout because the default one doesn't flush the stream immediately after writing to it.

Beware that flushing after every line is measurably slower.

> One of our configuration was configuring a logger and another was reconfiguring it. The stdout stream was probably closed in the process somewhere.
>
> In conclusion, beware of your loggers ;)
>
>
>
> On Tue, Jul 29, 2014 at 8:32 AM, François Stephany <[hidden email]> wrote:
> Yes, it works for me on OSX.l But it says "FileWriteError: File stdout is closed" when doing exactly the same thing on the Arch Linux of one of our programmer.
>
> We'll investigate and test on another Linux distro...
>
>
> On Mon, Jul 28, 2014 at 10:50 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> I think we need a better bug report, for me (Mac OS X) this works fine:
>
> $ ./pharo Pharo.image eval 'FileStream stdout nextPutAll: 42 factorial asString; cr. #done' > out.txt
>
> $ cat out.txt
> 1405006117752879898543142606244511569936384000000000
> #done
>
> So, what exactly is not working ?
>
> On 28 Jul 2014, at 21:30, stepharo <[hidden email]> wrote:
>
> > Francois
> >
> > can you open a bug entry because this is not nice.
> >
> > Stef
> >
> > On 28/7/14 16:46, François Stephany wrote:
> >>
> >> $ pharo Pharo-30852.image > /tmp/test.log
> >>
> >> Outputting somethind to stdout results in:
> >> "FileWriteError: File stdout is closed"
> >>
> >> * Arch Linux
> >> * Pharo 30852.
> >>
> >> $ pharo --version
> >>
> >> 3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
> >> NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
> >> NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
> >> https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
> >> Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux
> >>
> >>
> >> Did I miss something?
> >>
> >
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Writing on stdout when redirecting the standard output

fstephany
Yep, we haven't measured yet how slower it gets but we don't have a lot of traffic for this logger.
It was annoying to have a delay when observing logs so we flush the stream all the time. We were also afraid of missing information in the case of a pharo crash (hopefully that doesnt happen too much ;))


On Tue, Jul 29, 2014 at 10:06 AM, Sven Van Caekenberghe <[hidden email]> wrote:

On 29 Jul 2014, at 09:49, François Stephany <[hidden email]> wrote:

> Uh. We nailed it.

Good !

> We implemented a custom Logger writing to stdout because the default one doesn't flush the stream immediately after writing to it.

Beware that flushing after every line is measurably slower.

> One of our configuration was configuring a logger and another was reconfiguring it. The stdout stream was probably closed in the process somewhere.
>
> In conclusion, beware of your loggers ;)
>
>
>
> On Tue, Jul 29, 2014 at 8:32 AM, François Stephany <[hidden email]> wrote:
> Yes, it works for me on OSX.l But it says "FileWriteError: File stdout is closed" when doing exactly the same thing on the Arch Linux of one of our programmer.
>
> We'll investigate and test on another Linux distro...
>
>
> On Mon, Jul 28, 2014 at 10:50 PM, Sven Van Caekenberghe <[hidden email]> wrote:
> I think we need a better bug report, for me (Mac OS X) this works fine:
>
> $ ./pharo Pharo.image eval 'FileStream stdout nextPutAll: 42 factorial asString; cr. #done' > out.txt
>
> $ cat out.txt
> 1405006117752879898543142606244511569936384000000000
> #done
>
> So, what exactly is not working ?
>
> On 28 Jul 2014, at 21:30, stepharo <[hidden email]> wrote:
>
> > Francois
> >
> > can you open a bug entry because this is not nice.
> >
> > Stef
> >
> > On 28/7/14 16:46, François Stephany wrote:
> >>
> >> $ pharo Pharo-30852.image > /tmp/test.log
> >>
> >> Outputting somethind to stdout results in:
> >> "FileWriteError: File stdout is closed"
> >>
> >> * Arch Linux
> >> * Pharo 30852.
> >>
> >> $ pharo --version
> >>
> >> 3.9-7 #1 Thu May 15 18:29:30 CEST 2014 gcc 4.6.3 [Production ITHB VM]
> >> NBCoInterpreter NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
> >> NBCogit NativeBoost-CogPlugin-GuillermoPolito.19 uuid: acc98e51-2fba-4841-a965-2975997bba66 May 15 2014
> >> https://github.com/pharo-project/pharo-vm.git Commit: ed4a4f59208968a21d82fd2406f75c2c4de558b2 Date: 2014-05-15 18:23:04 +0200 By: Esteban Lorenzano <[hidden email]> Jenkins build #14826
> >> Linux pharo-linux 3.2.0-31-generic-pae #50-Ubuntu SMP Fri Sep 7 16:39:45 UTC 2012 i686 i686 i386 GNU/Linux
> >>
> >>
> >> Did I miss something?
> >>
> >
>
>
>
>