[Gambas-user] exec also working as shell why?

T Lee Davidson t.lee.davidson at gmail.com
Fri Jan 10 19:44:45 CET 2020


On 1/10/20 11:38 AM, PICCORO McKAY Lenz wrote:
> i have a code where i want to pass content to main.. but i never raised the content:
> cadena only are filled with content after main raises end, why .. if i not use shell?
> i attached the project
> 
> i have a class and a module main, class are:
> 
> Public cadena As String = "ver"
> Public linea As Collection
> Private lineas As String[]
> 
> Public Sub Main()
> Exec ["cat", "/etc/courier/authdaemonrc"] For Read As "Processo"
> End

Perhaps because you didn't tell the interpreter to "Wait" for the command to finish before continuing on?

If you're simply trying to get the contents of "/etc/courier/authdaemonrc" for parsing, then why not just retrieve it into a 
string variable and then parse it without bothering with Process_Read()?

For example:
Exec ["cat", "/etc/courier/authdaemonrc"] to cadena
lineas = Split(cadena, gb.NewLine, "", True)
For a = 0 To lineas.max
   ...
Next


-- 
Lee


More information about the User mailing list