Skip to content

Plugin causes terminal freeze on Windows due to execSync in SessionStart hook #16

@K4leri

Description

@K4leri

Environment

  • OS: Windows 11
  • Terminal: Windows Terminal
  • Claude Code version: 2.1.31
  • Plugin version: mind@memvid 1.0.11
  • Node.js: v22.13.1

Description

The mind@memvid plugin causes Claude Code to completely freeze on Windows. The terminal becomes unresponsive - no keyboard input is accepted, and the UI appears stuck.

Root Cause

The issue is in smart-install.js hook which runs on SessionStart. The hook uses execSync to run npm install:

execSync("npm install --production --no-fund --no-audit", {
cwd: pluginRoot,
stdio: "pipe",
timeout: 120000 // 2 minute timeout
});

On Windows, execSync with stdio: "pipe" appears to interfere with the parent process's stdin handling, causing the terminal to become completely unresponsive even though:

  1. The hook itself completes successfully
  2. The hook returns { continue: true } correctly
  3. Debug logs show no errors

Steps to Reproduce

  1. Install mind@memvid plugin on Windows
  2. Launch Claude Code in Windows Terminal
  3. Terminal freezes - cannot type anything

Workaround

Add "disableAllHooks": true to ~/.claude/settings.json or disable the plugin:
{
"enabledPlugins": {
"mind@memvid": false
}
}

Suggested Fix

Consider one of these approaches:

  1. Use spawn with async handling instead of execSync:
    import { spawn } from 'child_process';

function installDepsAsync() {
return new Promise((resolve) => {
const child = spawn('npm', ['install', '--production', '--no-fund', '--no-audit'], {
cwd: pluginRoot,
stdio: 'ignore', // Completely detach stdio
shell: true,
windowsHide: true // Hide console window on Windows
});
child.on('close', () => resolve(true));
child.on('error', () => resolve(false));
});
}

  1. Make the hook async - return early and install in background
  2. Skip install check if marker exists - currently it runs npm install synchronously even on first check
  3. Use stdio: 'ignore' instead of stdio: 'pipe' to fully detach from terminal

Debug Log (relevant section)

[DEBUG] Matched 2 unique hooks for query "startup"
[DEBUG] Hooks: Checking initial response for async: {"continue":true}
[DEBUG] Hooks: Parsed initial response: {"continue":true}
[DEBUG] Hook SessionStart:startup (SessionStart) success: {"continue":true}
[DEBUG] [REPL:mount] REPL mounted, disabled=false

The logs show everything completes successfully, but the terminal is frozen at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions