[Gambas-user] Problem with finished Shell Process.State <> Process.Stopped

Bruce Steers bsteers4 at gmail.com
Mon Feb 27 05:40:22 CET 2023

On Mon, 27 Feb 2023 at 02:45, T Lee Davidson <t.lee.davidson at gmail.com>

> On 2/26/23 19:01, Jussi Lahtinen wrote:
> > 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.
> >
> > Jussi
> You are right, Jussi. I changed that line to:
> If pYtDlp And If pYtDlp.State = Process.Running Then
> and it works as it should.
> I'll blame my glasses for that one.
> @BruceS, yes, one should be careful with compound conditionals when
> testing objects. That's why I used the short-circuit "And
> If" as opposed to simply "And".

i did not realize that using 'And If' actually protects from that so cheers
it often tricks me that.

Almost as much as misplacing the Not in a test
If Not sString Begins "Something" Then
  Print "Damn it!!  'Not' is in the wrong place and has only tested if the
string exists and I will need bug hunt this! :-\"

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230227/9fb79a93/attachment.htm>

More information about the User mailing list