This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
这是一个通过编程试验 Node.js 对进程调度 bash 行为的实验项目。
探索和研究 Node.js 如何创建和管理子进程来执行 bash/shell 命令,包括:
- 使用
child_process模块(spawn,exec,fork等)创建 bash 进程 - 研究进程间的通信机制(stdin, stdout, stderr)
- 测试不同平台(Windows/Linux/Mac)下的 bash 行为差异
- 分析进程生命周期和信号处理
- 运行时: Node.js
- 核心模块:
child_process,events,stream - 目标: bash/shell 进程
read PATH hints to set bash exprot PATH
# 运行某个测试脚本(具体取决于项目中的文件)
node <script-name>.js
# 使用 npm 运行(如果有 package.json)
npm test
npm startchild_process.spawn()- 启动新进程child_process.exec()- 执行 shell 命令child_process.fork()- 创建 Node.js 子进程stdio流配置 - 进程间通信- 进程信号处理 - SIGTERM, SIGKILL 等
在 Windows (MINGW64) 环境下,bash 可通过 Git Bash 或 WSL 提供,需要注意:
- 路径分隔符差异(
\vs/) - 可执行文件查找机制
- shell 环境变量的继承