[BUG] Claude Code kills itself AND VS Code when using 'pkill node' to terminate Node.js servers

Status Closed — not planned
Maintainer reply None cached
Activity 15 comments · opened Jul 6, 2025 · closed Jan 18, 2026

Bug Description

Claude Code terminates its own process AND Visual Studio Code when attempting to kill Node.js servers using broad process termination commands like pkill -f node. Since both Claude Code and VS Code run on Node.js/Electron, these commands result in catastrophic self-termination of the entire development environment.

Steps to Reproduce

  1. Open VS Code with Claude Code integration enabled (using /ide command)
  2. Start a Node.js server in a project (e.g., npm run dev or node server.js)
  3. Ask Claude Code to stop the server or restart it
  4. If the initial termination attempt fails (e.g., using port-specific methods), Claude Code may escalate to using:
  • pkill -f node && sleep 2
  • pkill node
  • killall node
  1. Both Claude Code AND VS Code immediately terminate

Expected Behavior

Claude Code should:

  • Use targeted process termination methods (port-specific or PID-specific)
  • Never use commands that would terminate all Node.js processes
  • Preserve both its own process and the VS Code process while managing other Node.js processes
  • Understand that VS Code (built on Electron) depends on Node.js processes

Actual Behavior

Claude Code executes commands that kill ALL Node.js processes, including:

  • Claude Code's own process
  • VS Code's main and renderer processes
  • Any other Node-based tools in the development environment

This results in complete loss of the development environment.

Proposed Fix

Add the following constraints to Claude Code's system message:

CRITICAL: Never use process termination commands that could kill Claude Code or integrated development environments:
- NEVER use: pkill node, pkill -f node, killall node, or any variation that kills all node processes
- BE AWARE: Both Claude Code and VS Code run on Node.js - killing all node processes will terminate both
- ALWAYS use targeted termination methods:
  - Port-specific: lsof -ti :PORT | xargs kill -9
  - PID-specific: kill -9 <specific_pid>
  - Process name with exclusion: pkill -f "node server.js" (specific script only)
  - npm/yarn specific: npm stop, yarn stop
- If unsure about which Node process to kill, ask the user for clarification
- Remember: Killing all node processes will destroy the entire development environment

Impact

  • Severity: CRITICAL
  • User Experience:
  • Sudden termination of entire development environment
  • Loss of all open VS Code tabs and unsaved work
  • Loss of Claude Code session and context
  • Need to restart everything from scratch
  • Data Loss: High risk of losing unsaved work in VS Code
  • Frequency: Very common when working with Node.js development servers

Environment

  • Affects all versions of Claude Code
  • All platforms (macOS, Linux, Windows)
  • Especially critical when using VS Code integration (/ide command)
  • Occurs during Node.js development workflows

Additional Context

This is a critical self-preservation issue that affects the entire development workflow. Claude Code needs to understand that:

  1. It runs on Node.js
  2. VS Code (Electron-based) runs on Node.js
  3. Many development tools run on Node.js
  4. Using broad pkill node commands is essentially a "nuclear option" that destroys the entire development environment

Common scenario: Developer asks Claude Code to "restart the server" or "kill the process on port 3000" and loses their entire VS Code session with all unsaved work.

Suggested Workarounds (until fixed)

Users should add to their CLAUDE.md file:

NEVER use pkill node, killall node, or any command that kills all node processes.
Always use port-specific termination: lsof -ti :PORT | xargs kill -9

View original on GitHub ↗

15 Comments

tomolry666 · 11 months ago

This is happening pretty much ever day for me, despite having the explicit instructions in the CLAUDE.MD to not kill node process. It's a major problem. I am running WSL Ubuntu and it ends up killing the OS.

  • "Do NOT kill processes without prompting the user."

I will try the "NEVER use pkill node, killall node, or any command that kills all node processes.
Always use port-specific termination: lsof -ti :PORT | xargs kill -9"

...but I am not optimistic.

tomolry666 · 11 months ago

I can confirm this workaround DOES NOT WORK.

NEVER use pkill node, killall node, or any command that kills all node processes.
Always use port-specific termination: lsof -ti :PORT | xargs kill -9

luweiming · 11 months ago

Yes. it's problematic when you start doing a lot of server-side testing. for it keeps starting new server with new ports, like 1000, 1001, 1002 etc not staying with the same port, then it will kill itself with the pkill command

JeongJunGyo · 11 months ago

## Windows PowerShell equivalent issue

This same issue occurs on Windows when using PowerShell commands:

```powershell
powershell -c "Get-Process -Name node | Stop-Process -Force"

Claude Code terminates itself along with other node processes, same behavior as the Unix pkill node command mentioned
in this issue.

Windows-specific workaround needed:
Currently using port-specific termination as suggested:
# Safe alternative for Windows
netstat -ano | findstr :PORT | for /f "tokens=5" %a in ('more') do taskkill /PID %a /F
# or
powershell -c "Get-NetTCPConnection -LocalPort PORT | Select-Object -ExpandProperty OwningProcess | Stop-Process
-Force"

Would be great if the fix also covers Windows PowerShell commands to prevent self-termination across all platforms.

n-sviridenko · 11 months ago

Omg. I managed to find the root cause. Guys, you saved my day.

n-sviridenko · 11 months ago

Furthermore, it's not just about node - if you ask it to pkill ANY process, it'll kill itself

claude --mcp-config .cursor/mcp.json --dangerously-skip-permissions --model claude-sonnet-4-20250514 --add-dir /tmp/ --output-format stream-json --verbose --print "Run 'pkill -f \"foo\""
{"type":"system","subtype":"init","cwd":"/home/foo","session_id":"87785fd0-b76e-49b6-bc1f-e433f759b4ce","tools":["Task","Bash","Glob","Grep","ExitPlanMode","Read","Edit","MultiEdit","Write","NotebookEdit","WebFetch","TodoWrite","WebSearch","BashOutput","KillShell","SlashCommand","mcp__llms-txt__list_doc_sources","mcp__llms-txt__fetch_docs","ListMcpResourcesTool","ReadMcpResourceTool"],"mcp_servers":[{"name":"llms-txt","status":"connected"}],"model":"claude-sonnet-4-20250514","permissionMode":"bypassPermissions","slash_commands":["compact","context","cost","init","output-style:new","pr-comments","release-notes","todos","review","security-review"],"apiKeySource":"ANTHROPIC_API_KEY","output_style":"default","agents":["general-purpose","statusline-setup","output-style-setup"],"uuid":"7ae493cd-3bf4-44de-bc68-1369fa0d9d59"}
{"type":"assistant","message":{"id":"msg_017YCVCghQP7TM5UfFAY91Ai","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"I'll run the `pkill -f \"foo\"` command to kill all processes matching \"foo\"."}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":1901,"cache_read_input_tokens":16080,"cache_creation":{"ephemeral_5m_input_tokens":1901,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"87785fd0-b76e-49b6-bc1f-e433f759b4ce","uuid":"2f8811fa-4d80-4dab-9e22-d5d104c72bba"}
{"type":"assistant","message":{"id":"msg_017YCVCghQP7TM5UfFAY91Ai","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"tool_use","id":"toolu_01TArjW7t6wZuY6No46Z7jeX","name":"Bash","input":{"command":"pkill -f \"foo\"","description":"Kill all processes matching pattern \"foo\""}}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":1901,"cache_read_input_tokens":16080,"cache_creation":{"ephemeral_5m_input_tokens":1901,"ephemeral_1h_input_tokens":0},"output_tokens":3,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"87785fd0-b76e-49b6-bc1f-e433f759b4ce","uuid":"e1404c92-d21a-47ea-99d5-1a156d63436a"}
zsh: terminated  claude --mcp-config .cursor/mcp.json --dangerously-skip-permissions --model
n-sviridenko · 11 months ago

And suggestion of @tomolry666 worked actually:

claude --mcp-config .cursor/mcp.json --dangerously-skip-permissions --model claude-sonnet-4-20250514 --add-dir /tmp/ --output-format stream-json --verbose --print "Run 'lsof -ti :1234 | xargs -r kill -9'"
{"type":"system","subtype":"init","cwd":"/home/foo","session_id":"4f438a43-9556-48f4-b07c-12d05729814b","tools":["Task","Bash","Glob","Grep","ExitPlanMode","Read","Edit","MultiEdit","Write","NotebookEdit","WebFetch","TodoWrite","WebSearch","BashOutput","KillShell","SlashCommand","mcp__llms-txt__list_doc_sources","mcp__llms-txt__fetch_docs","ListMcpResourcesTool","ReadMcpResourceTool"],"mcp_servers":[{"name":"llms-txt","status":"connected"}],"model":"claude-sonnet-4-20250514","permissionMode":"bypassPermissions","slash_commands":["compact","context","cost","init","output-style:new","pr-comments","release-notes","todos","review","security-review"],"apiKeySource":"ANTHROPIC_API_KEY","output_style":"default","agents":["general-purpose","statusline-setup","output-style-setup"],"uuid":"be866286-1c8b-4b8c-823b-944a84b14a2e"}
{"type":"assistant","message":{"id":"msg_016GmuTkWSXSb3WxfLMss4BU","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"tool_use","id":"toolu_014vntvbB6V1U7c6CdVEQxyR","name":"Bash","input":{"command":"lsof -ti :1234 | xargs -r kill -9","description":"Kill processes using port 1234"}}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":4,"cache_creation_input_tokens":12719,"cache_read_input_tokens":5271,"cache_creation":{"ephemeral_5m_input_tokens":12719,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"4f438a43-9556-48f4-b07c-12d05729814b","uuid":"04d38940-e6e8-43e2-9c9b-7b2e8719ea63"}
{"type":"user","message":{"role":"user","content":[{"tool_use_id":"toolu_014vntvbB6V1U7c6CdVEQxyR","type":"tool_result","content":"","is_error":false}]},"parent_tool_use_id":null,"session_id":"4f438a43-9556-48f4-b07c-12d05729814b","uuid":"51d4037a-eba1-4d34-bb49-1819dfee62a1"}
{"type":"assistant","message":{"id":"msg_012sdi2fRYoL34MYB1c5qjo1","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"Done. Any processes using port 1234 have been terminated."}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":8,"cache_creation_input_tokens":114,"cache_read_input_tokens":17990,"cache_creation":{"ephemeral_5m_input_tokens":114,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"4f438a43-9556-48f4-b07c-12d05729814b","uuid":"442d03d7-399e-4494-973c-61c02e100d03"}
{"type":"result","subtype":"success","is_error":false,"duration_ms":7402,"duration_api_ms":8973,"num_turns":3,"result":"Done. Any processes using port 1234 have been terminated.","session_id":"4f438a43-9556-48f4-b07c-12d05729814b","total_cost_usd":0.05845324999999999,"usage":{"input_tokens":12,"cache_creation_input_tokens":12833,"cache_read_input_tokens":23261,"output_tokens":108,"server_tool_use":{"web_search_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":12833}},"modelUsage":{"claude-3-5-haiku-20241022":{"inputTokens":1829,"outputTokens":58,"cacheReadInputTokens":0,"cacheCreationInputTokens":0,"webSearchRequests":0,"costUSD":0.0016952,"contextWindow":200000},"claude-sonnet-4-20250514":{"inputTokens":12,"outputTokens":108,"cacheReadInputTokens":23261,"cacheCreationInputTokens":12833,"webSearchRequests":0,"costUSD":0.05675804999999999,"contextWindow":200000}},"permission_denials":[],"uuid":"5981736c-7fcb-48cc-bcaf-18614eb9c603"}
pkit · 10 months ago

@tomolry666 @n-sviridenko I've fixed it with a custom protection library loaded with LD_PRELOAD:

{"type":"system","subtype":"init","cwd":"/workspace","session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","tools":["Task","Bash","Glob","Grep","ExitPlanMode","Read","Edit","Write","NotebookEdit","WebFetch","TodoWrite","WebSearch","BashOutput","KillShell","Skill","SlashCommand"],"mcp_servers":[],"model":"claude-sonnet-4-20250514","permissionMode":"bypassPermissions","slash_commands":["compact","context","cost","init","output-style:new","pr-comments","release-notes","todos","review","security-review"],"apiKeySource":"ANTHROPIC_API_KEY","claude_code_version":"2.0.28","output_style":"default","agents":["general-purpose","statusline-setup","output-style-setup","Explore","Plan"],"skills":[],"plugins":[],"uuid":"1df09526-56d0-4983-8c9f-8a0260a51267"}
{"type":"assistant","message":{"model":"claude-sonnet-4-20250514","id":"msg_01KpJhusyUZbhUtSf4E7BcBk","type":"message","role":"assistant","content":[{"type":"text","text":"I'll run the `pkill` command to kill processes matching the pattern \"foo\"."}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":0,"cache_read_input_tokens":14737,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":8,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","uuid":"b97fcd3d-f7da-41c5-b4fe-86df979294e5"}
{"type":"assistant","message":{"model":"claude-sonnet-4-20250514","id":"msg_01KpJhusyUZbhUtSf4E7BcBk","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_01EX7F3FdyYoWyJh35wtFf6G","name":"Bash","input":{"command":"pkill -f \"foo\"","description":"Kill processes matching pattern \"foo\""}}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":0,"cache_read_input_tokens":14737,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":8,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","uuid":"a9d9b313-8b65-4068-b900-aa44616e1910"}
{"type":"user","message":{"role":"user","content":[{"type":"tool_result","content":"[libnosuicide] Protection initialized (SIGTERM only). Protected PIDs: 98,1","is_error":true,"tool_use_id":"toolu_01EX7F3FdyYoWyJh35wtFf6G"}]},"parent_tool_use_id":null,"session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","uuid":"050e6e02-c910-4382-b341-504d664af8d9"}
{"type":"assistant","message":{"model":"claude-sonnet-4-20250514","id":"msg_016uQRutFD9buF8EPDjiX7rZ","type":"message","role":"assistant","content":[{"type":"text","text":"The `pkill` command has been executed. The system shows a protection mechanism is in place that prevents certain processes from being killed (showing protection for PIDs 98 and 1). \n\nIf there were any processes matching the pattern \"foo\" running, they would have been terminated by this command. The lack of additional output typically indicates either:\n1. No processes were found matching the pattern \"foo\", or  \n2. The matching processes were successfully killed\n\nYou can verify if any processes matching \"foo\" are still running by using:\n```bash\npgrep -f \"foo\"\n```"}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":6,"cache_creation_input_tokens":137,"cache_read_input_tokens":14737,"cache_creation":{"ephemeral_5m_input_tokens":137,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","uuid":"0eadcc94-cc5d-454e-9750-a36522b8f60f"}
{"type":"result","subtype":"success","is_error":false,"duration_ms":10631,"duration_api_ms":16946,"num_turns":4,"result":"The `pkill` command has been executed. The system shows a protection mechanism is in place that prevents certain processes from being killed (showing protection for PIDs 98 and 1). \n\nIf there were any processes matching the pattern \"foo\" running, they would have been terminated by this command. The lack of additional output typically indicates either:\n1. No processes were found matching the pattern \"foo\", or  \n2. The matching processes were successfully killed\n\nYou can verify if any processes matching \"foo\" are still running by using:\n```bash\npgrep -f \"foo\"\n```","session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","total_cost_usd":0.01672395,"usage":{"input_tokens":8,"cache_creation_input_tokens":137,"cache_read_input_tokens":29474,"output_tokens":230,"server_tool_use":{"web_search_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":137}},"modelUsage":{"claude-sonnet-4-20250514":{"inputTokens":8,"outputTokens":230,"cacheReadInputTokens":29474,"cacheCreationInputTokens":137,"webSearchRequests":0,"costUSD":0.01282995,"contextWindow":200000},"claude-haiku-4-5-20251001":{"inputTokens":399,"outputTokens":147,"cacheReadInputTokens":0,"cacheCreationInputTokens":0,"webSearchRequests":0,"costUSD":0.001134,"contextWindow":200000},"claude-sonnet-4-5-20250929":{"inputTokens":410,"outputTokens":102,"cacheReadInputTokens":0,"cacheCreationInputTokens":0,"webSearchRequests":0,"costUSD":0.00276,"contextWindow":200000}},"permission_denials":[],"uuid":"2ae69b9f-9ccb-47de-9b78-91811f2db507"}

Works in Linux only though.

wagjim-wsi · 10 months ago

I'm having the same issue. It keeps killing all node.js servers even after repeatedly being asked to preserve its own PID or only kill node.js servers that are listening on port 3000 during development.

dev-qwanyx · 9 months ago

I have the same problem.
Reading your comments, it's not clear if there is a turnaround.

I also tried to run node and backend on separate shells, but this is a nightmare.
Not only can Claude not see the backend logs, which is annoying by itself.
But it does not hesitate to create new node and backend instances, making the whole thing very confusing, and at the end of the day it still manages to kill itself

isvicy · 9 months ago
@tomolry666 @n-sviridenko I've fixed it with a custom protection library loaded with LD_PRELOAD:我用 LD_PRELOAD 加载了一个自定义保护库,修好了这个问题: {"type":"system","subtype":"init","cwd":"/workspace","session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","tools":["Task","Bash","Glob","Grep","ExitPlanMode","Read","Edit","Write","NotebookEdit","WebFetch","TodoWrite","WebSearch","BashOutput","KillShell","Skill","SlashCommand"],"mcp_servers":[],"model":"claude-sonnet-4-20250514","permissionMode":"bypassPermissions","slash_commands":["compact","context","cost","init","output-style:new","pr-comments","release-notes","todos","review","security-review"],"apiKeySource":"ANTHROPIC_API_KEY","claude_code_version":"2.0.28","output_style":"default","agents":["general-purpose","statusline-setup","output-style-setup","Explore","Plan"],"skills":[],"plugins":[],"uuid":"1df09526-56d0-4983-8c9f-8a0260a51267"} {"type":"assistant","message":{"model":"claude-sonnet-4-20250514","id":"msg_01KpJhusyUZbhUtSf4E7BcBk","type":"message","role":"assistant","content":[{"type":"text","text":"I'll run the pkill command to kill processes matching the pattern \"foo\"."}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":0,"cache_read_input_tokens":14737,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":8,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","uuid":"b97fcd3d-f7da-41c5-b4fe-86df979294e5"} {"type":"assistant","message":{"model":"claude-sonnet-4-20250514","id":"msg_01KpJhusyUZbhUtSf4E7BcBk","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_01EX7F3FdyYoWyJh35wtFf6G","name":"Bash","input":{"command":"pkill -f \"foo\"","description":"Kill processes matching pattern \"foo\""}}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":2,"cache_creation_input_tokens":0,"cache_read_input_tokens":14737,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":8,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","uuid":"a9d9b313-8b65-4068-b900-aa44616e1910"} {"type":"user","message":{"role":"user","content":[{"type":"tool_result","content":"[libnosuicide] Protection initialized (SIGTERM only). Protected PIDs: 98,1","is_error":true,"tool_use_id":"toolu_01EX7F3FdyYoWyJh35wtFf6G"}]},"parent_tool_use_id":null,"session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","uuid":"050e6e02-c910-4382-b341-504d664af8d9"} {"type":"assistant","message":{"model":"claude-sonnet-4-20250514","id":"msg_016uQRutFD9buF8EPDjiX7rZ","type":"message","role":"assistant","content":[{"type":"text","text":"The pkill command has been executed. The system shows a protection mechanism is in place that prevents certain processes from being killed (showing protection for PIDs 98 and 1). \n\nIf there were any processes matching the pattern \"foo\" running, they would have been terminated by this command. The lack of additional output typically indicates either:\n1. No processes were found matching the pattern \"foo\", or \n2. The matching processes were successfully killed\n\nYou can verify if any processes matching \"foo\" are still running by using:\n``bash\npgrep -f \"foo\"\n`"}],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":6,"cache_creation_input_tokens":137,"cache_read_input_tokens":14737,"cache_creation":{"ephemeral_5m_input_tokens":137,"ephemeral_1h_input_tokens":0},"output_tokens":1,"service_tier":"standard"}},"parent_tool_use_id":null,"session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","uuid":"0eadcc94-cc5d-454e-9750-a36522b8f60f"} {"type":"result","subtype":"success","is_error":false,"duration_ms":10631,"duration_api_ms":16946,"num_turns":4,"result":"The pkill command has been executed. The system shows a protection mechanism is in place that prevents certain processes from being killed (showing protection for PIDs 98 and 1). \n\nIf there were any processes matching the pattern \"foo\" running, they would have been terminated by this command. The lack of additional output typically indicates either:\n1. No processes were found matching the pattern \"foo\", or \n2. The matching processes were successfully killed\n\nYou can verify if any processes matching \"foo\" are still running by using:\n`bash\npgrep -f \"foo\"\n``","session_id":"f65a6541-6cd1-44b7-8d8a-b1d985de59d8","total_cost_usd":0.01672395,"usage":{"input_tokens":8,"cache_creation_input_tokens":137,"cache_read_input_tokens":29474,"output_tokens":230,"server_tool_use":{"web_search_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":137}},"modelUsage":{"claude-sonnet-4-20250514":{"inputTokens":8,"outputTokens":230,"cacheReadInputTokens":29474,"cacheCreationInputTokens":137,"webSearchRequests":0,"costUSD":0.01282995,"contextWindow":200000},"claude-haiku-4-5-20251001":{"inputTokens":399,"outputTokens":147,"cacheReadInputTokens":0,"cacheCreationInputTokens":0,"webSearchRequests":0,"costUSD":0.001134,"contextWindow":200000},"claude-sonnet-4-5-20250929":{"inputTokens":410,"outputTokens":102,"cacheReadInputTokens":0,"cacheCreationInputTokens":0,"webSearchRequests":0,"costUSD":0.00276,"contextWindow":200000}},"permission_denials":[],"uuid":"2ae69b9f-9ccb-47de-9b78-91811f2db507"} Works in Linux only though.仅适用于 Linux。

@pkit could you please share you solution?

pkit · 9 months ago

@isvicy

https://gist.github.com/pkit/0ac76533716132e3547af02e2885c2f6
I think you can figure out how to launch that one.
I just do something like:

gcc -shared -o /claude/libnosuicide.so -fPIC /claude/libnosuicide.c -ldl \
    && cat /claude/libnosuicide.js > /tmp/claude.js \
    && tail -n+2 /claude/node_modules/@anthropic-ai/claude-agent-sdk/cli.js >> /tmp/claude.js \
    && mv /tmp/claude.js /claude/node_modules/@anthropic-ai/claude-agent-sdk/cli.js \
    && rm -fr /claude/libnosuicide.c /claude/libnosuicide.js
github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] · 7 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 7 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.