From 521b8061097ea0076fb32eabd5be37b4dd55b5e3 Mon Sep 17 00:00:00 2001 From: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Thu, 9 Dec 2021 14:38:48 +0000 Subject: [PATCH] Update docs for techdocs runCommand (#8332) --- .../src/stages/generate/helpers.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/techdocs-common/src/stages/generate/helpers.ts b/packages/techdocs-common/src/stages/generate/helpers.ts index 794200fb7d..7c46f4e966 100644 --- a/packages/techdocs-common/src/stages/generate/helpers.ts +++ b/packages/techdocs-common/src/stages/generate/helpers.ts @@ -18,7 +18,7 @@ import { isChildPath } from '@backstage/backend-common'; import { Entity } from '@backstage/catalog-model'; import { assertError, ForwardedError } from '@backstage/errors'; import { ScmIntegrationRegistry } from '@backstage/integration'; -import { spawn } from 'child_process'; +import { SpawnOptionsWithoutStdio, spawn } from 'child_process'; import fs from 'fs-extra'; import gitUrlParse from 'git-url-parse'; import yaml, { DEFAULT_SCHEMA, Type } from 'js-yaml'; @@ -39,19 +39,18 @@ export function getGeneratorKey(entity: Entity): SupportedGeneratorKey { } export type RunCommandOptions = { + /** command to run */ command: string; + /** arguments to pass the command */ args: string[]; - options: object; + /** options to pass to spawn */ + options: SpawnOptionsWithoutStdio; + /** stream to capture stdout and stderr output */ logStream?: Writable; }; /** - * - * @param options the options object - * @param options.command the command to run - * @param options.args the arguments to pass the command - * @param options.options options used in spawn - * @param options.logStream the log streamer to capture log messages + * Run a command in a sub-process, normally a shell command. */ export const runCommand = async ({ command,