Skip to content

monitor dir create - #9

Merged
kenchou merged 1 commit into
mainfrom
feature/dir-create
Jul 8, 2025
Merged

monitor dir create#9
kenchou merged 1 commit into
mainfrom
feature/dir-create

Conversation

@kenchou

@kenchou kenchou commented Jul 8, 2025

Copy link
Copy Markdown
Owner

No description provided.

@kenchou
kenchou requested a review from Copilot July 8, 2025 08:43
@kenchou
kenchou merged commit 3b6b1ed into main Jul 8, 2025
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances directory monitoring by adding support for detecting directory creation events and simplifying the fswatch branch.

  • inotifywait now watches for both moved_to and create events and distinguishes between directory creation and move events.
  • Event parsing logic for inotifywait has been refined to separately report create vs. move directory events.
  • fswatch branch logic simplified to treat any detected directory path as a directory event.
Comments suppressed due to low confidence (1)

monitor-dir.sh:100

  • You've added create event handling in the inotifywait invocation—consider adding automated tests or integration checks to verify that directory creation events are correctly detected and reported.
    inotifywait --exclude '(.tmp)' -r -m --format '%w%f %e' -e moved_to,create "$@" | while IFS= read -r line; do

Comment thread monitor-dir.sh
Comment on lines +104 to +109
if [[ "$line" == *"CREATE,ISDIR"* ]] || [[ "$line" == *"MOVED_TO,ISDIR"* ]]; then
# 使用更安全的方式解析路径和事件
# 找到最后一个空格的位置,分离路径和事件
event_part="${line##* }"
path_part="${line% *}"

echo "检测到目录移动事件: $path_part"
if [[ "$line" == *"CREATE,ISDIR"* ]]; then

Copilot AI Jul 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current string match assumes a fixed event order (CREATE,ISDIR or MOVED_TO,ISDIR). It would be more robust to split event_part on commas and check for the presence of CREATE/MOVED_TO and ISDIR independently, handling any order or additional flags.

Copilot uses AI. Check for mistakes.
@kenchou
kenchou deleted the feature/dir-create branch July 8, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants