[Gambas-user] options to kill a process started via SHELL

T Lee Davidson t.lee.davidson at gmail.com
Fri Jul 8 14:53:28 CEST 2022


On 7/8/22 07:00, KKing wrote:
>> Get the process object returned by SHELL or EXEC, then create a timer
>> that triggers you couple of seconds later, kill the process in the timer
>> event handler, and stop the timer as you don't need it anymore.
> I did get it working by
> 
> within the one subroutine,
> 1. getting the process object
> 2. invoking another SHELL for a CURL to trap the data I wanted (which is usually called via timer)
> 3. then killed the process object.
> 
> Occasionally the response from the CURL is not as expected, and to get back as desired I seemingly need to launch firefox which 
> was what I want to kill after doing.
> 
> that was my second attempt.
> 
> I initially had at top level of the class
> Public $hProcess as Process
> 
> Then in a "start" subroutine get the $hProcess which within that subroutine $hProcess.State returned 1 (running) and I started 
> the timer.
> But when Timer1_Timer kicked in it always said $Process was not running (yet what it had invoked clearly was still running).
> Is that a bug or I crafted that poorly?
> The timer code is checking response of the CURL and if not as expected it needs to launch firefox again, curl it, and kill that 
> firefox.

Being able to see how you're coding it, or at least a demo project, might be helpful.


-- 
Lee


More information about the User mailing list