takt/src/infra/task/process.ts
nrslib 620e384251 interactiveモジュールの分割とタスク再キュー方式への移行
interactive.tsからsummary/runSelector/runSessionReader/selectorUtilsを分離し、
run session参照をrouting層からinstructMode層に移動。instructBranchで新タスク
作成の代わりに既存タスクのrequeueを使用する方式に変更。worktree確認プロンプトを
廃止し常時有効化。
2026-02-18 18:49:21 +09:00

24 lines
505 B
TypeScript

/**
* Shared process-level helpers.
*/
export function isProcessAlive(ownerPid: number): boolean {
try {
process.kill(ownerPid, 0);
return true;
} catch (err) {
const nodeErr = err as NodeJS.ErrnoException;
if (nodeErr.code === 'ESRCH') {
return false;
}
if (nodeErr.code === 'EPERM') {
return true;
}
throw err;
}
}
export function isStaleRunningTask(ownerPid: number | undefined): boolean {
return ownerPid == null || !isProcessAlive(ownerPid);
}