From e85c8582c572f00cf43b723c1b71b8787207a883 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Thu, 7 May 2026 08:46:41 +0200 Subject: [PATCH] Return exit code 1 on CTRL+C cancellation User-initiated cancellation should signal failure to the shell just like any other abnormal exit, so CI and scripts don't silently swallow it. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- src/tooling/docs-builder/Middleware/CatchExceptionMiddleware.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tooling/docs-builder/Middleware/CatchExceptionMiddleware.cs b/src/tooling/docs-builder/Middleware/CatchExceptionMiddleware.cs index c5a93e9991..327471738f 100644 --- a/src/tooling/docs-builder/Middleware/CatchExceptionMiddleware.cs +++ b/src/tooling/docs-builder/Middleware/CatchExceptionMiddleware.cs @@ -31,6 +31,7 @@ public async ValueTask InvokeAsync(CommandContext context, CommandMiddlewareDele if (ex is OperationCanceledException && context.CancellationToken.IsCancellationRequested && _cancelKeyPressed) { logger.LogInformation("Cancellation requested, exiting."); + context.ExitCode = 1; return; } _ = collector.StartAsync(context.CancellationToken);