Skip to content

A module to view raw stdout output of raw commands' execution

License

Notifications You must be signed in to change notification settings

server-state/raw-module

Folders and files

NameName
Last commit message
Last commit date
Jul 15, 2020
Dec 21, 2019
Sep 6, 2019
Sep 6, 2019
Jun 4, 2020
Sep 12, 2019
Sep 27, 2019
Sep 5, 2019
Sep 5, 2019
Sep 5, 2019
Sep 27, 2019
Feb 16, 2022
Nov 25, 2021
Sep 5, 2019

Repository files navigation

raw-module

Build Status GitHub npm version Coverage Status module type: official

A module for the server-state project. This module allows running "raw" terminal commands and getting their output to stdout and stderr. Commands do not get run in chronological order and each command may only get run once per SM.

Example

As options, the raw-module SMF takes an array of commands (string[]) that get executed:

serverState.registerModule('raw', require('@server-state/raw-module'), [
    'ls',
    'whoami',
    'echo Hello'
]);

It then returns the outputs of these commands in a key-value-pair object where the commands serve as keys (this is also the reason why duplicate commands aren't allowed).

Example return object:

{
    "ls":{"stdout":"[...]","stderr":"","cmd":"ls","code":0},
    "whoami":{"stdout":"[...]","stderr":"","cmd":"whoami","code":0},
    "echo Hello":{"stdout":"Hello","stderr":"","cmd":"echo Hello","code":0}
}