Using OSProcess

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

Using OSProcess

Mike Hales
I must be missing something obvious, but how can I get the results of executing an external command. 

OSProcess command: 'ls /etc'

returns me an ExternalUnixProcess. I just want a string of the command results. This seems to basic to be hard, but I'm stumped. In VisualWorks and GemStone this is just a one liner.

Thanks,

Mike



Reply | Threaded
Open this post in threaded view
|

Re: Using OSProcess

Sean P. DeNigris
Administrator
Mike Hales wrote
I must be missing something obvious, but how can I get the results of
executing an external command.

OSProcess command: 'ls /etc'
It may be possible, but the standard advice is to use CommandShell's PipeableOSProcess.

Nabble has a great searchable archive of the mailing lists.  Searching for "command line output" produced http://forum.world.st/OSProcess-return-value-from-command-td68289.html, which has the specifics of what you want.

Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Using OSProcess

CdAB63
In reply to this post by Mike Hales
Em 19-11-2010 15:00, Mike Hales escreveu:
I must be missing something obvious, but how can I get the results of executing an external command. 

OSProcess command: 'ls /etc'
Try:

| pc1 |

    pc1 := (PipeableOSProcess command: 'ls -l' ) output.

    Transcript show: pc1.

returns me an ExternalUnixProcess. I just want a string of the command results. This seems to basic to be hard, but I'm stumped. In VisualWorks and GemStone this is just a one liner.

Thanks,

Mike