I create file and show its contents inside of virtual machine using Docker:
touch file.txt
docker run \
--rm -it \
--volume $(pwd):/app \
--workdir /app \
alpine:3.6 \
sh -c '\
while : ; do \
cat file.txt ;\
sleep 1 ;\
done \
'
Then I change file locally:
date > file.txt
Everything is ok.
But when I change file in PhpStorm, I get an error message for about 20 seconds:
cat: can't open 'file.txt': I/O error
What is possible reason of this behaviour and how can I diagnose it?
(Docker 17.10, VirtualBox 5.1.30, PhpStorm 2017.2.4)
Try disabling "safe write" option in PhpStorm settings: Settings/Preferences | Appearance & Behavior | System Settings --> Use "safe write"...
With that option enabled IDE writes into a temp file first (e.g. file.__temp_jb__
) and only then renames it into the actual target (file.txt
).
It looks like such manipulation (original file gets deleted and replaced by another one) somehow conflicts with your script.