luminarys-sdk 0.2.0

Rust SDK for building Luminarys WASM skills
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Shell execution. Requires `shell.enabled`.

use crate::abi::{call_host, raw};
use crate::types::*;

/// Execute a shell command and return output and exit code. Requires `shell.enabled`.
pub fn shell_exec(req: &ShellExecRequest) -> Result<ShellExecResult, SkillError> {
    let resp: ShellExecResult = call_host(raw::shell_exec, req)?;
    if !resp.error.is_empty() {
        return Err(SkillError(resp.error));
    }
    Ok(resp)
}