'Non-UI application (console / server application)
Sub Process_Globals
Private sh As Shell
Private RunLastError As String
End Sub
Sub AppStart (Args() As String)
Log("Hello world!!!")
Run_Command( "cat", Array As String( "/etc/os-release"))
StartMessageLoop
End Sub
Sub Run_Command( cli As String, args As List)
Log( "Run_Command")
sh.InitializeDoNotHandleQuotes( "cli", cli, args)
sh.WorkingDirectory = File.DirApp
sh.Run(-1) '<<< changed
Wait for cli_ProcessCompleted( Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
' #if Debug
Log(Success & "; ExitCode = " & ExitCode)
Log("StdOut = " & StdOut)
Log("StdErr = " & StdErr)
' #end if
If Success And ExitCode = 0 Then 'all is OK
RunLastError = ""
Else
RunLastError = StdErr
End If
End Sub
'OUTPUT:
'
'Hello world!!!
'Run_Command
'true; ExitCode = 0
'StdOut = PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
'NAME="Debian GNU/Linux"
'VERSION_ID="11"
'VERSION="11 (bullseye)"
'VERSION_CODENAME=bullseye
'ID=debian
'HOME_URL="https://www.debian.org/"
'SUPPORT_URL="https://www.debian.org/support"
'BUG_REPORT_URL="https://bugs.debian.org/"
'
'StdErr =