nodejs / nodejs/node

`fs.watch`: endless file events reported

Đang mở
#61,398 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.3k
Merge trung bình
4 ngày 2 giờ
Pull request đã merge (30 ngày)
283

Mô tả

Version

v22.21.1

Platform
Microsoft Windows NT 10.0.26200.0 x64
Subsystem

No response

What steps will reproduce the bug?
  • create a folder vscode
  • run this command in that folder mkdir .vscode && echo {"editor.fontSize": 33}>.vscode\settings.json
  • run the following node.js script in a terminal pointing to the folder vscode/.vscode
  • run this command in that folder rmdir /s /q .vscode\ && mkdir .vscode && echo {"editor.fontSize": 33}>.vscode\settings.json
const fs = require("fs");

fs.watch("<path to a folder>/.vscode", (eventType, filename) => {
    if (filename) {
        console.log(`Event Type: ${eventType}`);
        console.log(`Filename: ${filename}`);
    } else {
        console.log("Filename not provided");
    }
});
How often does it reproduce? Is there a required condition?

Always.

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

After running the last command there should be change events reported in an endless fashion.

What do you see instead?

Endless reports of:

Filename: \\?\C:\Users\bpasero\Desktop\testing-watcher\.vscode
Event Type: rename
Filename: \\?\C:\Users\bpasero\Desktop\testing-watcher\.vscode
Event Type: rename
Filename: \\?\C:\Users\bpasero\Desktop\testing-watcher\.vscode
Event Type: rename
Filename: \\?\C:\Users\bpasero\Desktop\testing-watcher\.vscode
Event Type: rename
Additional information

Originally reported in VS Code repo as https://github.com/microsoft/vscode/issues/287800

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với API fs.watch và tái hiện chuỗi trên Windows bằng script Node.js được cung cấp. So sánh các sự kiện đổi tên lặp lại và các giá trị đường dẫn với hành vi dự kiến đã nêu, sau đó lần theo đường dẫn theo dõi tệp trên Windows. Hoàn tất khi bản tái hiện không còn tạo ra các sự kiện vô tận ngoài ý muốn và hành vi liên quan được bao phủ bởi một bài kiểm thử.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, node.js
Lĩnh vực
backend, operating-systems
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.