MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / runText

Function runText

scripts/integration/cli.mjs:1778–1802  ·  view source on GitHub ↗
(command, args, options = {})

Source from the content-addressed store, hash-verified

1776}
1777
1778function runText(command, args, options = {}) {
1779 const startedAt = Date.now();
1780 logCommand(command, args);
1781 const result = spawnSync(command, args, {
1782 cwd: root,
1783 encoding: "utf8",
1784 input: options.input,
1785 env: options.env ? { ...process.env, ...options.env } : process.env,
1786 timeout: options.timeoutMs ?? 120_000,
1787 });
1788 if (result.status !== 0) {
1789 throw new Error(
1790 `${command} ${args.join(" ")} failed with ${result.status ?? result.signal}\n${result.stdout}\n${result.stderr}`,
1791 );
1792 }
1793 const elapsedMs = Date.now() - startedAt;
1794 recordCommandTiming(command, args, elapsedMs);
1795 if (options.maxElapsedMs && elapsedMs > options.maxElapsedMs) {
1796 throw new Error(
1797 `${command} ${args.join(" ")} took ${elapsedMs}ms, above ${options.maxElapsedMs}ms budget`,
1798 );
1799 }
1800 logCommandResult(command, args, elapsedMs, result.stdout);
1801 return result.stdout;
1802}
1803
1804function runBuffer(command, args, options = {}) {
1805 const startedAt = Date.now();

Callers 7

mainFunction · 0.70
simdeckTextFunction · 0.70
runJsonFunction · 0.70

Calls 3

logCommandFunction · 0.85
recordCommandTimingFunction · 0.85
logCommandResultFunction · 0.85

Tested by

no test coverage detected