[squeak-dev] OSProcess Question

Tom Beckmann tomjonabc at gmail.com
Thu Aug 25 14:54:45 UTC 2022


Some things you could try:

* What's the return code in the inspector?
* Does it work if you run the lsp from a terminal?
* Does e.g. /bin/ls work?
* If you start squeak from a terminal, is something printed to its
stdout/stderr?

Best,
Tom

On Thu, Aug 25, 2022, 16:14 Eric Gade <eric.gade at gmail.com> wrote:

> I am having a problem (I think) getting even basic external process to
> run. For example, if I execute this code and inspect it:
> ```
> proc := ExternalUnixOSProcess
> forkAndExec: '/opt/homebrew/bin/typescript-language-server'
> arguments: { '--stdio' }
> environment: nil
> ```
>
> The process status is complete immediately (if it works the process should
> run until explicitly terminated). This is also the case if  I append
> `/bin/zsh ` or `/bin/sh ` to the command.
>
> What am I missing?
>
> On Thu, Aug 25, 2022 at 8:41 AM David T. Lewis <lewis at mail.msen.com>
> wrote:
>
>> Hi Eric,
>>
>> On Thu, Aug 25, 2022 at 08:10:35AM -0400, Eric Gade wrote:
>> > Hello,
>> >
>> > I've been unable to find good documentation / examples of an OSProcess
>> use
>> > case. How can I start an external process that remains running while I
>> pipe
>> > data into its stdin and read data from its stdout?
>> >
>>
>> For this you will want to use a PipeableOSProcess, which allows you to
>> start and external process, write to its stdin, and read from its stdout
>> and stderr. The class comment gives an overview.
>>
>> PipeableOSProcess is part of the CommandShell package, so be sure to load
>> CommandShell along with OSProcess.
>>
>> > To be specific, I am starting to toy around with the JS/Typescript LSP
>> > server
>> > <
>> https://github.com/typescript-language-server/typescript-language-server
>> >,
>> > which seems to expect input on stdin (rather than using sockets or
>> whatnot)
>> >
>>
>> If you happen to have tk/wish installed on your computer, try evaluating
>> "PipeableOSProcess tkExample" to see something that may be similar to what
>> you have in mind. It starts an external process running /usr/bin/wish with
>> pipes connected to stdin/stdout/stderr to send commands to the wish shell
>> and to read its output.
>>
>> HTH,
>>
>> Dave
>>
>>
>>
>
> --
> Eric
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220825/613da06a/attachment.html>


More information about the Squeak-dev mailing list