nodejs / nodejs/node

--watch restarts only once

オープン
#54,774 コメント 17 件 リアクション 5 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

libuv stale watch-mode
主要言語
JavaScript
スター
122k
フォーク
37.4k
平均マージ
4日 3時間
マージ済み PR(30日)
272

説明

Version

v20.15.1

Platform
Linux derby 6.6.46-0-lts #1-Alpine SMP PREEMPT_DYNAMIC 2024-08-16 08:05:54 x86_64 Linux
Subsystem

No response

What steps will reproduce the bug?

f.js contains only console.log('hello')

node --watch f.js
hello
Completed running 'f.js'

Change f.js to console.log('hello world')

Restarting 'f.js'
hello world
Completed running 'f.js'

Change f.js again, e.g. console.log('this change will not restart watcher')
No change in the watch output.

(I'm changing the file outside of the debounce/throttle period)

How often does it reproduce? Is there a required condition?

It happens every time.

What is the expected behavior? Why is that the expected behavior?

I would expect that --watch would restart after every write to f.js, not just after the first change made to the file.

What do you see instead?

--watch only seems to restart after making the first change to the file.

Additional information

Also seeing this problem on Termux for Android node v22.5.1

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず node --watch f.js で問題を再現します。debounce/throttle の期間外にファイルを複数回変更してください。--watch のエントリポイントとその再起動処理を追跡します。完了の条件は、f.js への後続の書き込みがすべてプロセスを再起動し、報告された環境で動作が検証されることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, nodejs
領域
cli
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
64/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。