[Gambas-user] How to stop a gb.inotify watch

james at lixce.com james at lixce.com
Fri Oct 29 04:32:59 CEST 2021


In my gb.qt5.webview  based web browser I'm starting a file watch with:

wchLink = New Watch("/tmp/Cntrl_lixce-nexus", True) As "extCntl"

and then monitor for other programs to write a URL to that file.

Everything works great but I cannot figure out how to stop the watch so that I can close the program gracefully. Tried using a pipe instead but it slows the browser to an absolute crawl, and I am avoiding dbus.

I was using:

Public Sub Form_Close()
  Try Kill "/tmp/Cntrl_lixce-nexus"  'segfaults with or without this line
  Wait
  Quit
End

Which effectively forces the program to exit but it is very ugly ending in a segfault.

I'm currently using:

Public Sub Form_Close()
  Try Kill "/tmp/Cntrl_lixce-nexus"
  Wait
  Exec ["kill", Application.Id]
End

Which is a little more graceful (no segfault) but is still pretty ugly.

The inotify man 7 page shows an "inotify_rm_watch" command but I don't know of any way to call it from Gambas.

Any insight would be greatly appreciated.

J. Jordan

 



More information about the User mailing list