[Cuis-dev] OSProcess command: '.....' --> How do I detect if the process has terminated?
lewis at mail.msen.com
lewis at mail.msen.com
Mon Mar 10 15:35:59 PDT 2025
Hello Hannes,
Try this:
child := OSProcess command: 'ps'.
child printString. "==> 'an ExternalUnixOSProcess with pid 42622 on
/bin/sh (complete, normal termination with status 0)' "
child isComplete. "==> true"
When using OSProcess like this, you are creating a child unix process
that runs the /bin/sh executable program, which is a unix shell that
then runs the /usr/bin/ps program (or whatever other program you want to
run). From the Cuis image, the /bin/sh program is the child of your VM
image, and the /usr/bin/ps program is the child of the /bin/sh program.
From Cuis, you can see the run status (and exit status) of the /bin/sh
program, although you cannot directly see the results of the program
that the shell was running. Although limited, this should be enough
information to tell you if your program has run to completion.
Better handling of child processes, pipes, exit status and so forth is
provided by the CommandShell package, which is designed to work with
OSProcess. However, CommandShell is not yet available for Cuis.
Nevertheless, the simple OSProcess class>>command: implementation is
sufficient for many things.
HTH,
Dave
On 2025-03-10 21:15, H. Hirzel via Cuis-dev wrote:
> Hi
>
> I want to use OSProcess to do file conversions with pandoc *
>
> OSProcess command: 'pandoc --from=Markdown --to=DocBook
> C:\Users\Hirzel\Documents\Cuis-Smalltalk-7061-UserFiles\manual.txt
> --output=C:\Users\Hirzel\Documents\manual.xml'
>
> The conversion process runs in a separate thread. How can I determine
> if the thread has terminated e.g. to start processing manual.xml.
>
> I do not necessarily mind if the UI is blocked.
>
> Regards
>
> Hannes
>
> ------------------------------
>
> * https://pandoc.org/
>
> a universal document converter, e.g. from Markdown to Docbook, docx,
> html etc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250310/0b7b1384/attachment.htm>
More information about the Cuis-dev
mailing list