diff --git a/ClaudeCodeSharpSDK/Execution/ClaudeExec.cs b/ClaudeCodeSharpSDK/Execution/ClaudeExec.cs index 38d202b..a37e0ff 100644 --- a/ClaudeCodeSharpSDK/Execution/ClaudeExec.cs +++ b/ClaudeCodeSharpSDK/Execution/ClaudeExec.cs @@ -57,6 +57,7 @@ public sealed class ClaudeExec private const string AnthropicApiKeyEnv = "ANTHROPIC_API_KEY"; private const string AnthropicBaseUrlEnv = "ANTHROPIC_BASE_URL"; + private const string ClaudeCodeNestingEnv = "CLAUDECODE"; private const string ContinueAndResumeConflictMessage = "ContinueMostRecent and ResumeSessionId cannot both be set."; private const string FlagAssignmentSeparator = "="; private const string ReplayUserMessagesUnsupportedMessage = @@ -303,7 +304,9 @@ internal IReadOnlyDictionary BuildEnvironment(string? baseUrl, s foreach (DictionaryEntry variable in Environment.GetEnvironmentVariables()) { - if (variable.Key is string key && variable.Value is string value) + if (variable.Key is string key + && variable.Value is string value + && !string.Equals(key, ClaudeCodeNestingEnv, StringComparison.OrdinalIgnoreCase)) { environment[key] = value; } diff --git a/Directory.Build.props b/Directory.Build.props index 85ab563..be4ba23 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,7 +13,7 @@ true latest-recommended true - 1.0.1 + 1.0.2 $(Version)