hfuse icon indicating copy to clipboard operation
hfuse copied to clipboard

fuseRunInline blocks

Open hankfire opened this issue 7 years ago • 1 comments

Hi I am trying to use HFuse for a hit-and-run-scenario: my application should mount the virtual FS, execute an external shell command (using callCommand) that uses that FS, unmount the FS.

It seems the fuseRunInline was made for that, where I pass the callCommand bit into the 3rd parameter (act). 1st and 2nd parameter (register and unregister) are "optional" in that I can just pass pure (), right? So like this

main :: IO ()
main = do
  fuseRunInline
     (\fd op -> pure ())
     (\x -> pure())
     (\s -> threadDelay 20000000)
    "hellofs" ["/home/user/tmp"]
    helloFSOps
    defaultExceptionHandler

except instead of the callCommand bit I put in a 20 sec delay as a placeholder, the actual command will come later.

If I run this (with ghc-options -threaded and -with-rtsopts=-N10 then it mounts, waits 20 second and unmounts just fine. I can verify the mound using the mount unix command during those 20 seconds. But during those 20 seconds I cannot e.g. list the contents of the virtual FS, i.e. `ls -l /home/user/tmp'. That blocks until the 20 seconds are over and then fails with an error message.

hankfire avatar Oct 24 '18 00:10 hankfire

@hankfire Did you ever get this to work? I have a use case that is identical to the one you describe (mount fs and run external command), but I have no luck either.

rickynils avatar Oct 08 '19 23:10 rickynils