B4J Question [Solved] Shell.run blocking server

djmainero

Member
Licensed User
Hi!
I'm developing an api to interact with mssql.
Now I'm trying to generate a PDF file with an external exe, to do so I call shell.run an powershell script and wait for it to close to write a response, but while the external exe is running the server not respond any other request.

Handle Sub:
s.Initialize
s.Append("powershell -file C:\GeneraPDF.ps1 ").Append(h5).Append(" ").Append(Dir).Append("/").Append(FileName.ToString)

Dim shl As Shell
shl.InitializeDoNotHandleQuotes("shl", "cmd", Array("/C", s.ToString))
shl.Run(20000)
StartMessageLoop

shl_ProcessCompleted:
Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
    If Success And ExitCode = 0 Then
        Log("Success")
        Log(StdOut)
    Else
        Log("Error: " & StdErr)
    End If
    StopMessageLoop
End Sub

Thanks in advance!
 
Top