Capturing stdout

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

Capturing stdout

Sean P. DeNigris
Administrator
I want to write a test for an NB Mac system call example (Issue 13147). I can check the exit code easily, the output goes to stdout of the image. Can I capture it somehow? thx :)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Capturing stdout

Max Leske
start pharo from the console?

On 28.03.2014, at 12:57, Sean P. DeNigris <[hidden email]> wrote:

> I want to write a test for an NB Mac system call example (Issue 13147). I can
> check the exit code easily, the output goes to stdout of the image. Can I
> capture it somehow? thx :)
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Capturing-stdout-tp4751320.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Capturing stdout

Max Leske
Forget what I said… Just rambling…


On 28.03.2014, at 13:48, Max Leske <[hidden email]> wrote:

> start pharo from the console?
>
> On 28.03.2014, at 12:57, Sean P. DeNigris <[hidden email]> wrote:
>
>> I want to write a test for an NB Mac system call example (Issue 13147). I can
>> check the exit code easily, the output goes to stdout of the image. Can I
>> capture it somehow? thx :)
>>
>>
>>
>> -----
>> Cheers,
>> Sean
>> --
>> View this message in context: http://forum.world.st/Capturing-stdout-tp4751320.html
>> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>>
>


Reply | Threaded
Open this post in threaded view
|

Re: Capturing stdout

Sean P. DeNigris
Administrator
Max Leske wrote
Forget what I said… Just rambling…
Ha ha, I was doing the confused-puppy-head-tilt (see http://da0cb6511396a92928c7-488d28a6573db6ac4a247063b638fcb9.r77.cf2.rackcdn.com/files/o-DOG-COCKED-HEAD-facebook.jpg)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Capturing stdout

Max Leske

On 28.03.2014, at 15:55, Sean P. DeNigris <[hidden email]> wrote:

> Max Leske wrote
>> Forget what I said… Just rambling…
>
> Ha ha, I was doing the confused-puppy-head-tilt (see
> http://da0cb6511396a92928c7-488d28a6573db6ac4a247063b638fcb9.r77.cf2.rackcdn.com/files/o-DOG-COCKED-HEAD-facebook.jpg)

:p

>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Capturing-stdout-tp4751320p4751409.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Capturing stdout

Emilio Oca-3
In reply to this post by Sean P. DeNigris
Hi

I managed to do that in Windows using

ProcessWrapper new
           useStdout;
           startWithShellCommand: aCommand ;
           upToEnd.

where aCommand is something like: "someApp.exe -p params moreParams >
G:\other\place\stdou.log"

This is what Hernan Morales offered

> Gofer it
> url: 'http://www.smalltalkhub.com/mc/hernan/ProcessWrapper/main';
> package: 'ProcessWrapper-Core';
> package: 'ProcessWrapper-Plugin';
> package: 'ProcessWrapper-Tests';
> load.
>
> ProcessWrapper new
>            useStdout;
>            startWithShellCommand: 'dir | sort';
>            upToEnd

Best
   Emilio

> -----Mensaje original-----
> De: Pharo-dev [mailto:[hidden email]] En nombre de
> Sean P. DeNigris
> Enviado el: Viernes, 28 de Marzo de 2014 08:58
> Para: [hidden email]
> Asunto: [Pharo-dev] Capturing stdout
>
> I want to write a test for an NB Mac system call example (Issue 13147).
> I can
> check the exit code easily, the output goes to stdout of the image. Can
> I
> capture it somehow? thx :)
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Capturing-stdout-
> tp4751320.html
> Sent from the Pharo Smalltalk Developers mailing list archive at
> Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Capturing stdout

Sean P. DeNigris
Administrator
Emilio Oca-3 wrote
I managed to do that in Windows using... ProcessWrapper...
As it's for a core test, I need to find a way to do it without loading additional libraries. I could pipe the output to a tmp file if there's nothing...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Capturing stdout

Max Leske
Maybe… Since Pharo now has a command line handler, you could redirect stdout to the vm process? Will probably not work while the image is running I guess. But maybe it will (see for example http://serverfault.com/questions/178457/can-i-send-some-text-to-the-stdin-of-an-active-process-running-in-a-screen-sessi)


On 28.03.2014, at 21:56, Sean P. DeNigris <[hidden email]> wrote:

> Emilio Oca-3 wrote
>> I managed to do that in Windows using... ProcessWrapper...
>
> As it's for a core test, I need to find a way to do it without loading
> additional libraries. I could pipe the output to a tmp file if there's
> nothing...
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Capturing-stdout-tp4751320p4751521.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Capturing stdout

philippeback
On Windows, there is work to do on the VM platform sources to get the command line output to work properly.

There are a set of MsgBox calls in there where one could use a nice little printf/puts.

I've been looking at it but there is more than meets the eye there.


Phil



On Fri, Mar 28, 2014 at 10:23 PM, Max Leske <[hidden email]> wrote:
Maybe… Since Pharo now has a command line handler, you could redirect stdout to the vm process? Will probably not work while the image is running I guess. But maybe it will (see for example http://serverfault.com/questions/178457/can-i-send-some-text-to-the-stdin-of-an-active-process-running-in-a-screen-sessi)


On 28.03.2014, at 21:56, Sean P. DeNigris <[hidden email]> wrote:

> Emilio Oca-3 wrote
>> I managed to do that in Windows using... ProcessWrapper...
>
> As it's for a core test, I need to find a way to do it without loading
> additional libraries. I could pipe the output to a tmp file if there's
> nothing...
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Capturing-stdout-tp4751320p4751521.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>



Reply | Threaded
Open this post in threaded view
|

Re: Capturing stdout

Sean P. DeNigris
Administrator
philippeback wrote
On Windows, there is work to do on the VM platform sources to get the
command line output to work properly.
It would be great to have something like an announcer that one can register with to receive stdout
Cheers,
Sean