Class RFuse::Fuse
In: lib/rfuse.rb
Parent: Object

Methods

exit   loop   run   sigint   sigterm   trap_signals  

Public Instance methods

Stop processing {loop} eg called from signal handlers, or some other monitoring thread

Main processing loop

Use {exit} to stop processing (or externally call fusermount -u)

Other ruby threads can continue while loop is running, however no thread can operate on the filesystem itself (ie with File or Dir methods)

@return [void] @raise [RFuse::Error] if already running or not mounted

Convenience method to run a mounted filesystem to completion.

@param [Array<String|Integer>] signals list of signals to handle.

  Default is all available signals. See {#trap_signals}

@return [void] @since 1.1.0 @see RFuse.main

sigint()

Alias for sigterm

Default signal handler to exit on TERM/INT @return [void] @see trap_signals

Set traps

The filesystem supports a signal by providing a `sig<name>` method. eg {sigint}

The fuse {loop} is notified of the signal via the self-pipe trick, and calls the corresponding

  `sig<name>` method, after any current filesystem operation completes.

This method will not override traps that have previously been set to something other than "DEFAULT"

Note: {Fuse} itself provides {sigterm} and {sigint}.

@param [Array<String>] signames

  List of signal names to set traps for, if the filesystem has methods to handle them.
  Use `Signal.list.keys` to try all available signals.

@return [Array<String>] List of signal names that traps have been set for.

@since 1.1.0

@example

  class MyFS < Fuse
     def sighup()
         # do something on HUP signal
     end
  end

  fuse = MyFS.new(*args)

  if fuse.mounted?
      # Below will result in (effectively) Signal.trap("HUP") { fuse.sighup() }
      fuse.trap_signals("HUP","USR1") # ==> ["HUP"]
      fuse.loop()
  end

[Validate]