Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node watch restarts only once when copying file in docker linux #56389

Open
wclr opened this issue Dec 29, 2024 · 1 comment
Open

Node watch restarts only once when copying file in docker linux #56389

wclr opened this issue Dec 29, 2024 · 1 comment

Comments

@wclr
Copy link

wclr commented Dec 29, 2024

Version

v21.5.0

Platform

Linux 0440267859e6 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 Linux

Docker image: node:21.5.0-alpine3.19

Subsystem

No response

What steps will reproduce the bug?

On linux running in docker with node I see the folloing problem: node --watch does restart only on first change of file (made with cp command). It works as expected if to change file in editor. I aslo tested the same version of node (v21.5.0) in WSL - it works as expected, so the problem is not in node version.

Image used for docker: node:21.5.0-alpine3.19

echo console.log("x") > /tmp/test.js
cp /tmp/test.js /tmp/test2.js

run

 node --watch /tmp/test2.js

Output:

x
Completed running '/tmp/test2.js'

Update file with cp:

echo console.log("x1") > /tmp/test.js
cp /tmp/test.js /tmp/test2.js

Watch should restart

Restarting '/tmp/test2.js'
x1
Completed running '/tmp/test2.js'

Update file again with cp second time:

echo console.log("x2") > /tmp/test.js
cp /tmp/test.js /tmp/test2.js

Watch doesn't restart.

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

Always.

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

Node watch restarts each time files is copied with cp command.

What do you see instead?

Node watch restarts only first time.

Additional information

Image used for docker: node:21.5.0-alpine3.19

@juanarbol
Copy link
Member

cc @nodejs/fs

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

No branches or pull requests

2 participants