Git exec(): child killed by a signal rejects with new Error('') and loses the signal information
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- node.js, typescript
- 領域
- tooling
調査の方向性
src/util/git.ts の内部 exec ヘルパーから始め、Node の code 引数と signal 引数を含む close イベントリスナーを調べます。出力がなくてもゼロ以外の終了コードと終了シグナルが伝達されるように拒否の動作を更新し、その後、ヘルパーの正常終了、失敗、シグナルによる終了の各経路を検証します。
索引モデルが issue の本文から書いたものです。
説明
Observed behavior
The internal exec helper in src/util/git.ts resolves/rejects on the close event:
cmdProcess.on('close', (code: number): void => {
if (code === 0) {
resolve(outputs.join(''));
} else {
reject(new Error(outputs.join('')));
}
});
Node's documentation says code may be null if the child was terminated by a signal (the signal name is the second argument to the listener). In that case:
- The type annotation
code: numberis wrong (it can benull). - The rejection becomes
new Error('')if the child was killed before producing any output, with no indication that it was killed or by which signal.
Expected behavior
The error should communicate either the non-zero exit code or the signal name, so a caller (or a developer reading logs) can tell why git terminated.
Minimal reproduction
import { spawn } from 'node:child_process';
const child = spawn('sleep', ['10']);
const outputs = [];
child.stdout?.on('data', d => outputs.push(String(d)));
child.stderr?.on('data', d => outputs.push(String(d)));
child.on('close', (code, signal) => {
console.log('code=', code, 'signal=', signal);
if (code === 0) { console.log('resolve', JSON.stringify(outputs.join(''))); }
else { console.log('reject', JSON.stringify(outputs.join(''))); }
});
setTimeout(() => child.kill('SIGTERM'), 50);
// -> code= null signal= SIGTERM
// -> reject \"\"
Suggested fix
cmdProcess.on('close', (code: number | null, signal: NodeJS.Signals | null): void => {
if (code === 0) {
resolve(outputs.join(''));
return;
}
const detail = outputs.join('');
const reason = signal != null
? `git was killed by ${signal}`
: `git exited with code ${code}`;
reject(new Error(detail ? `${reason}: ${detail}` : reason));
});
- 主要言語
- TypeScript
- スター
- 2
- フォーク
- 1
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
joewalker/loop-the-loop のほかの issue
-
bug S4
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
joewalker/loop-the-loop#88 ·
-
bug S3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
joewalker/loop-the-loop#83 ·
-
bug S3
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
joewalker/loop-the-loop#82 ·
-
bug S4
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
joewalker/loop-the-loop#79 ·
-
bug S4
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
joewalker/loop-the-loop#78 ·
joewalker/loop-the-loop の issue をすべて見る
似ている issue
-
ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
xavxyz/bei-shan-lin-shui#57 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] rag: sentence content can cross the reported sentence boundaries対応中かも @LJK-ikun が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIオープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
platformatic/mcp#361 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
siyuan-note/siyuan#20799 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信