sugo-module-shell
Shell module for SUGOS
Requirements
![Node.js](https://realglobe-inc.github.io/sugos-assets/images/nodejs-banner.png)
![NPM](https://realglobe-inc.github.io/sugos-assets/images/npm-banner.png)
Installation
$ npm install sugo-module-shell --save
Usage
Register module to SUGO-Actor
#!/usr/bin/env node /** * Example usage to register module on actor * @see https://github.com/realglobe-Inc/sugo-actor */'use strict' const sugoModuleShell = const sugoActor = const co =
Then, call the module from remote caller.
#!/usr/bin/env node /** * Example to call from caller * @see https://github.com/realglobe-Inc/sugo-caller */'use strict' const co = const assert = const sugoCaller =
Methods
The following methods are available from remote callers for the module.
- .spawn(command, args, options) -> number
- .exec(command, options) -> object
- .ping(pong) -> string
- .assert() -> boolean
number
.spawn(command, args, options) -> Spawn a command and pipe io to event emitting.
Param | Type | Description |
---|---|---|
command | string |
The command to run |
args | array |
List of string arguments |
options | Object |
Optional settings |
object
.exec(command, options) -> Execute a command and returns io as object.
Param | Type | Description |
---|---|---|
command | string |
The command to run, with space-separated arguments |
options | Object |
Optional settings |
string
.ping(pong) -> Test the reachability of a module.
Param | Type | Description |
---|---|---|
pong | string |
Pong message to return |
boolean
.assert() -> Test if the actor fulfills system requirements
Events
The following events my be emitted from the module.
Param | Description |
---|---|
"stdout" | Standard out from spawned process. |
"stderr" | Standard error from spawned process. |
License
This software is released under the Apache-2.0 License.