← All procedures
node.run
Run a Node.js script and wait for completion
CLI- Package
- @procedures/node · README
- Path
["node","run"]- CLI
mark node run --script <string>- As data
{"$proc":["node","run"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/node"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["node","run"], { script: "<script>" });
console.log(JSON.stringify(result));From the command line
$ mark node run --script <string>
As data, in a program
{ "$proc": ["node", "run"], "input": { "script": "<script>" } }Input
| Field | Type | Required | Default | Description |
|---|
script | string | yes | | Script path to run |
args | string[] | no | | Arguments to pass to the script |
cwd | string | no | | Working directory |
env | object | no | | Environment variables |
timeout | number | no | | Timeout in milliseconds. At the timeout, the script and its child processes are killed. |
maxOutputBytes | integer | no | | The most bytes kept of each output stream (default: 64 MiB). The procedure keeps the first bytes. |
Output
| Field | Type | Required | Default | Description |
|---|
exitCode | number | yes | | The exit code of the script |
stdout | string | yes | | The standard output |
stderr | string | yes | | The standard error |
truncated | boolean | no | | True when an output stream was longer than maxOutputBytes |
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"script": {
"type": "string",
"description": "Script path to run"
},
"args": {
"description": "Arguments to pass to the script",
"type": "array",
"items": {
"type": "string"
}
},
"cwd": {
"description": "Working directory",
"type": "string"
},
"env": {
"description": "Environment variables",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
},
"timeout": {
"description": "Timeout in milliseconds. At the timeout, the script and its child processes are killed.",
"type": "number"
},
"maxOutputBytes": {
"description": "The most bytes kept of each output stream (default: 64 MiB). The procedure keeps the first bytes.",
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"script"
]
},
"output": {
"type": "object",
"properties": {
"exitCode": {
"type": "number",
"description": "The exit code of the script"
},
"stdout": {
"type": "string",
"description": "The standard output"
},
"stderr": {
"type": "string",
"description": "The standard error"
},
"truncated": {
"description": "True when an output stream was longer than maxOutputBytes",
"type": "boolean"
}
},
"required": [
"exitCode",
"stdout",
"stderr"
],
"additionalProperties": {}
}
}