Pharo 8 - OSProcess or OSSubProcess or ?

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

Pharo 8 - OSProcess or OSSubProcess or ?

Paul DeBruicker
Hi -

What  is the recommended way to  run a shell command  from Pharo 8 and  get  the output from stdout into the image?  


Thanks

Paul
Reply | Threaded
Open this post in threaded view
|

Re: Pharo 8 - OSProcess or OSSubProcess or ?

Torsten Bergmann
Hi Paul,

you can use:

    LibC resultOfCommand: 'dir'

which is part of standard image.

Bye
T.


> Gesendet: Montag, 04. Mai 2020 um 20:05 Uhr
> Von: "PAUL DEBRUICKER" <[hidden email]>
> An: "Any question about pharo is welcome" <[hidden email]>
> Betreff: [Pharo-users] Pharo 8  - OSProcess or OSSubProcess or ?
>
> Hi -
>
> What  is the recommended way to  run a shell command  from Pharo 8 and  get  the output from stdout into the image?
>
>
> Thanks
>
> Paul
>

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 8 - OSProcess or OSSubProcess or ?

Paul DeBruicker
Thanks Torsten

That definitely works great.  Sometimes I mistype the commands.  Is there a
way to get the error rather than an empty string?  

e.g. running

 LibC resultOfCommand: 'dur'

gives an empty string rather than

  sh: dur: command not found

?

Paul





Torsten Bergmann wrote

> Hi Paul,
>
> you can use:
>
>     LibC resultOfCommand: 'dir'
>
> which is part of standard image.
>
> Bye
> T.
>
>
>> Gesendet: Montag, 04. Mai 2020 um 20:05 Uhr
>> Von: "PAUL DEBRUICKER" &lt;

> pdebruic@

> &gt;
>> An: "Any question about pharo is welcome" &lt;

> pharo-users@.pharo

> &gt;
>> Betreff: [Pharo-users] Pharo 8  - OSProcess or OSSubProcess or ?
>>
>> Hi -
>>
>> What  is the recommended way to  run a shell command  from Pharo 8 and
>> get  the output from stdout into the image?
>>
>>
>> Thanks
>>
>> Paul
>>





--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: Pharo 8 - OSProcess or OSSubProcess or ?

tbrunz
Hi Paul,

This blog post from Christopher Fuhrman may answer your question:

https://fuhrmanator.github.io/2019/03/16/LibC-Pharo-experiments.html

-Ted




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html