0.1.5 • Published 3 years ago

@thesave/exec_command v0.1.5

Weekly downloads
-
License
LGPL 2.1
Repository
-
Last release
3 years ago

execCommand

A Jolie library to execute a command with arguments in a separate process in an asynchronous way.

It currently relies on the Process standard Java library and it is mainly an asynchronous/reactive take on the standard Jolie Exec library, where all commands are issued asynchronously and the user can monitor their execution by receiving messages from the standard output and error of the process, as well as the notification of its termination with the related exit code.

Usage Example

from @jolie.execCommand.main import ExecCommand
from console import Console

service main(){

  inputPort IN {
    location: "local"
    oneWay: stdErr, stdOut, exitNotification
  }

  embed ExecCommand as ExecCommand
  embed Console as Console

  execution { concurrent }

  init {
    with( request ){
      .args[#.args] = "ping"
      .args[#.args] = "-c"
      .args[#.args] = "5"
      .args[#.args] = "localhost"
      .stderrStreamOperation = "stdErr"
      .stdoutStreamOperation = "stdOut"
      .terminationOperation = "exitNotification"
    }
    start@ExecCommand( request )
  }

  main {
    [ stdErr( message ) ]{
      println@Console( "ERROR: " + message )()
    }
    [ stdOut( message ) ]{
      println@Console( "STDOUT: " + message )()
    }
    [ exitNotification( exitCode ) ]{
      println@Console( "Command terminated with exit code" + exitCode )()
      exit
    }
  }
}

Roadmap

  • support multiple process executions with correlation sets
  • support process kill-signal via process ids
0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago