B4J Question I cann't receive message from jshell

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

I use shl_StdOut to receive data from "sudo nodejs server.js". server.js is a mini webserver. when i running "exceute", it run in background. it has some showing message but shl_StdOut can't receive them. Why ? Where am i missing ? :(

B4X:
Sub Execute As Boolean  
    If Not(ProcessIsRunning("nodejs server.js")) Then
        Dim sh As Shell
        sh.Initialize("shl", "sudo", Array As String("nodejs","server.js"))
        sh.WorkingDirectory="/home/pi/OpenPLC_v2"
        sh.Run(-1)
    End If
End Sub

B4X:
Sub shl_StdOut (Buffer() As Byte, Length As Int)
    Dim s1 As String=BytesToString(Buffer,0,Length,"UTF-8")
    Log("stdout:"&s1)  
End Sub
 
Top