[Gambas-user] Problem with finished Shell Process.State <> Process.Stopped
bsteers4 at gmail.com
Mon Feb 27 01:15:58 CET 2023
On Mon, 27 Feb 2023 at 00:02, Jussi Lahtinen <jussi.lahtinen at gmail.com>
> There is a bug in your code, this line makes no sense: "If pYtDlp And If
> pYtDlp.Running Then"
> Process.Running is constant with integer value 1. So, it is logically
> always true.
Aah yes well spotted Jussi.
Should be something like this really..
If pYtDlp Then
If pYtDlp.State = Process.Running Then
If Message.Warning("The download process is still running.", "Cancel
Close", "Abort Download") = 1 Then
Be careful with statements like...
If Object And If Object.Property
Because If Object is not valid then testing the property can raise an error.
> On Sun, Feb 26, 2023 at 10:20 PM T Lee Davidson <t.lee.davidson at gmail.com>
>> I am creating a project that uses yt-dlp to download media from Youtube.
>> The project uses the Process = Shell [command] For Read as "Process"
>> syntax because I want to track and display the progress.
>> Downloads work well, but the Process never goes to Process.Stopped state.
>> It works well on the command line and exits with code=0.
>> There is a trap in the Form.Close event to prevent closing the
>> application while a download is in progress. I always have to
>> choose to abort the Process even though it is finished.
>> Is this expected behavior, a bug, or my misunderstanding of Process?
>> Demo attached.
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User