← Back to team overview

kicad-developers team mailing list archive

Re: executing child processes

 

On Wed, Sep 28, 2016 at 5:48 AM, Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
> On 9/24/2016 7:51 PM, Cirilo Bernardo wrote:
>> As part of improving the STEP Export code to protect KiCad
>> from a hung child process and also to give the use the option
>> to cancel a long Export operation, I am doing some preliminary
>> design work on a dialog for launching such child processes.
>> My ideas so far:
>>
>> 1. Define a dialog which will:
>>  a. take a command line and optional environment pointer
>>  b. on ShowModal()  (+ override Show() to use ShowModal/EndModal),
>>     execute the command argument asynchronously
>
> You should not call ShowModal() or EndModal() anywhere in your dialog.
> Your assuming the user is going to show the dialog in the modal mode
> which may not be correct.  We currently have 3 potential dialog show
> modes, modal, modeless, and quasimodal.  Just overload the OnCancel()
> button event handler and let the underlying dialog modality code do it's
> job.
>

OK, no problem.

>>  c. display the command being executed and its parameters
>>  d. display the stdout + stderr messages from the child process
>>  e. offer a CANCEL and OK button; OK is grayed out
>>     until the process terminates, while CANCEL is active
>>     until the process terminates and clicking CANCEL will kill
>>     the child process.
>
> Everything else looks good.
>

I'll go ahead and put everything together then.  I was looking at the
possibility of a progress update display as well, especially for
OCE which can take quite a few seconds for some models.
A generic capture of stdout, stderr is where I would start, but I
think I'll give the dialog the option to take function pointers to use
for a progress display. This way stdout and/or stderr streams can
be processed by the user to extract clues about progress for whatever
external app is being run, if that app gives any clues at all.

- Cirilo

>>
>> This dialog essentially provides synchronous execution of the
>> command while making it possible to (a) cancel the process,
>> and (b) see the stdout + stderr output which may not otherwise
>> be accessible to the user. The dialog may be of some use in
>> other cases where we have synchronous execution such as
>> the BOM export.
>>
>> Any comments or suggestions, including other synchronous
>> child processes I may have missed?
>>
>> - Cirilo
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


References