comparison sat_frontends/jp/cmd_blog.py @ 3000:d603550d5e99

jp (blog/preview): fixed watch restoring when file is moved/deleted: with some editors (e.g. vim), when file is written it is actually replaced with a buffered one. In this case, jp replace the watch to check the new file, but it was not working anymore with latest version of inotify module. This patch fixes it by removing the old watch before adding a new one.
author Goffi <goffi@goffi.org>
date Fri, 12 Jul 2019 11:29:05 +0200
parents a1b98772af6b
children ab2696e34d29
comparison
equal deleted inserted replaced
2999:85d8e9a7284b 3000:d603550d5e99
799 u"{} event catched, changing the watch".format( 799 u"{} event catched, changing the watch".format(
800 ", ".join(event[1]) 800 ", ".join(event[1])
801 ), 801 ),
802 2, 802 2,
803 ) 803 )
804 i.remove_watch(self.content_file_path)
804 try: 805 try:
805 add_watch() 806 add_watch()
806 except InotifyError: 807 except InotifyError:
807 # if the new file is not here yet we can have an error 808 # if the new file is not here yet we can have an error
808 # as a workaround, we do a little rest 809 # as a workaround, we do a little rest