I have some code written in Xojo 2014 that I’m working on finally updating to run in Xojo 2019.
The code includes this snippet of an interactive shell (sh2):
If Not sh2.IsRunning Then
sh2.Execute "/bin/sh"
End If
Do
buffer = sh2.ReadAll
i = InStr(buffer,"$")
Loop Until i <> 0
sh2.WriteLine "su -m " + username
It used to be that would run /bin/sh, wait for the prompt to return and then switch the user.
Now for some reason, sh2.readAll isn’t returning anything and that goes into a permanent loop.
If I add sh2.poll
before buffer = sh2.ReadAll
I actually get the prompt quickly.
Did this change in a recent version of Xojo? Should I have always been doing sh2.poll? It seems like the documentation says sh2.ReadAll reads the contents without having to do a .poll