Skip to content

Instantly share code, notes, and snippets.

@ikatson
Created October 16, 2014 06:24
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikatson/7c6a7e84339305090457 to your computer and use it in GitHub Desktop.
Save ikatson/7c6a7e84339305090457 to your computer and use it in GitHub Desktop.
fswatch_propagate_pwd_changes_to_docker
function fswatch_propagate_pwd_changes_to_docker () {
echo "Starting fswatch on $PWD"
# tracking previous not to get into endless loop of changing the same file
local previous=''
fswatch -r "$PWD" | while read file; do
if [[ previous != "$file" ]]; then
docker run --rm -v "$PWD":"$PWD" busybox touch -c "$file"
fi
previous="$file"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment