I have a raspberry pi Non-UI App that works fine, however, I am attempting to use jShell to run imagemagick commands.
The command runs, and the target file gets created, but the sh1 success Wait For never fires.
This is in a different code module from the main module, and its started from a timer that fires on the main. This guarentees StartMessageLoop gets encountered before this routine runs.
There is a Wait For thats just ahead of this one that downloads the file first, and that works fine.
However, this routine, it never gets past the Wait For...
Here is the full subroutine:
any ideas?
The command runs, and the target file gets created, but the sh1 success Wait For never fires.
B4X:
Dim shl As Shell
shl.Initialize("shl", "convert", Array As String("temp.tif", "-filter", "point", "-resize", "4182x1848!", "temp.gif")) 'Perform an ImageMagic Conversion.
shl.WorkingDirectory = File.DirApp
shl.Run(10000) 'set a timeout of 10 seconds
Wait For sh1_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log("Are we getting past here?") 'Thats a big nope
If Success And ExitCode = 0 Then
Log("Success")
Log(StdOut)
Else
Log("Error: " & StdErr)
End If
This is in a different code module from the main module, and its started from a timer that fires on the main. This guarentees StartMessageLoop gets encountered before this routine runs.
There is a Wait For thats just ahead of this one that downloads the file first, and that works fine.
However, this routine, it never gets past the Wait For...
Here is the full subroutine:
B4X:
'this routine will download, cut, and process the latest radar frame to be sent to the unit.
Sub ProcessRegionalRadarFrame(Slot As Int, OffsetX As Int, OffsetY As Int) As ResumableSub
Dim CurrentFileName As String
'Download the latest radar image from the server
Dim job1 As HttpJob
job1.Initialize("", Me)
job1.Download("http://xxxxxxxxxxxx")
Wait For (job1) JobDone(job1 As HttpJob)
If job1.Success Then
CurrentFileName = job1.GetString
Else
Log(job1.ErrorMessage)
Return False
End If
job1.Release
'Now that we have the filename for the latest frame, lets download this frame.
job1.Download("http://xxxxxxxxxx" & CurrentFileName)
Wait For (job1) JobDone(job1 As HttpJob)
If job1.Success Then
Dim out As OutputStream = File.OpenOutput(File.DirApp, "temp.tif", False)
File.Copy2(job1.GetInputStream, out)
out.Close
Else
Log(job1.ErrorMessage)
Return False
End If
job1.Release
'Once we have the image, we need to chop this image and save it for conversion.
Dim shl As Shell
shl.Initialize("shl", "convert", Array As String("temp.tif", "-filter", "point", "-resize", "4182x1848!", "temp.gif")) 'Perform an ImageMagic Conversion.
shl.WorkingDirectory = File.DirApp
shl.Run(10000) 'set a timeout of 10 seconds
Wait For sh1_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
Log("Are we getting past here?") 'Thats a big nope
If Success And ExitCode = 0 Then
Log("Success")
Log(StdOut)
Else
Log("Error: " & StdErr)
End If
Return True
End Sub
any ideas?