[Gambas-user] hProcess is NULL

Ian Haywood ihaywood at ...1979...
Mon Dec 27 00:20:44 CET 2010


On Mon, Dec 27, 2010 at 4:46 AM, Demosthenes Koptsis
<demosthenesk at ...626...> wrote:
> Hello and merry Christmas,
>
> i have these lines of code
>
> -----------
>  sCommand = "/opt/avast4workstation-1.3.0/bin/avast -r " &
> txtVirusTempFolder.Text & "/avast-report.txt" & " -ac -t A " &
> txtVirusTempFolder.Text
>
>  PRINT sCommand
>
>  hProcess1 = SHELL sCommand WAIT FOR INPUT OUTPUT AS "AntiVirRun"
> -----------
>
> After that line the hProcess1 is NULL and i get NULL object in
>
> PUBLIC SUB AntiVirRun_Read()
Drop the "WAIT" keyword.
Wait makes Gambas stop and wait until the process is finished.
You don't want this: you want it to run in parallel with Gambas and
read its input.

Alternatively, if you just want to get the output as a string and not
interact with the program, you can do

   Shell sCommand To someString

I find often this does what I want without getting involved in the
Process variable.

Ian




More information about the User mailing list