diff --git a/src/lib/plugins/run-code-blocks/directives/command.ts b/src/lib/plugins/run-code-blocks/directives/command.ts index 21f7db3..7d9fb09 100644 --- a/src/lib/plugins/run-code-blocks/directives/command.ts +++ b/src/lib/plugins/run-code-blocks/directives/command.ts @@ -17,6 +17,15 @@ interface Args { captureOutput?: boolean; } +interface CommandError { + stdout?: string; + stderr?: string; +} + +function isCommandError(error: unknown): error is CommandError { + return typeof error === 'object' && error !== null && ('stdout' in error || 'stderr' in error); +} + export default async function command(node: Code, options: Options): Promise> { let args = parseArgs(node, [ optional('lang', String, 'shell'), @@ -52,13 +61,38 @@ export default async function command(node: Code, options: Options): Promise