B4J Library jShell library

Discussion in 'B4J Libraries & Classes' started by Erel, Nov 19, 2013.

  1. Derek Johnson

    Derek Johnson Active Member Licensed User

    Try using this: (this is in a UI based app using Tiny Core Linux)

    Code:
    Sub Test
        
    Dim shl As Shell
        shl.Initialize(
    "shl""sudo",  Array As String("ls"))
        shl.WorkingDirectory = 
    "/"
        shl.Run(
    10000'set a timeout of 10 seconds
    End Sub

    Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
        
    If Success And ExitCode = 0 Then
            
    Log("Success")
            Syslog(StdOut)
        
    Else
            
    Log("Error: " & StdErr)
        
    End If
    End Sub
    Just figured this out!
     
  2. Pedro Caldeira

    Pedro Caldeira Active Member Licensed User

    doesn't work.
    Get Exit code -1 in the result and does nothing
    I really need to run some scripts called from B4J, so any help is welcome

    Code:
    shl.initialize("shl","sudo"Array as String("./gtPro.sh")
    shl.WorkinDirectory = 
    file.DirApp
    shl.run(
    10000)
     
  3. OliverA

    OliverA Well-Known Member Licensed User

    What is the output of StdErr and StdOut?
    Code:
    Sub shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut AsString, StdErr AsString)
    Edit: What is the result of Success?
     
  4. Pedro Caldeira

    Pedro Caldeira Active Member Licensed User

    solved.
    instead of "sudo", used "bash".
    found an Erel post with this.
    Thanks anyway
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice