deal with getMounts crashing on android

This commit is contained in:
Joey Hess 2018-04-25 17:42:27 -04:00
parent f22a8c3485
commit f5df6244f3
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 7 additions and 0 deletions

View file

@ -13,9 +13,13 @@ module Utility.Mounts (getMounts, Mntent(..)) where
import qualified System.MountPoints import qualified System.MountPoints
import System.MountPoints (Mntent(..)) import System.MountPoints (Mntent(..))
import Utility.Exception
getMounts :: IO [Mntent] getMounts :: IO [Mntent]
#ifndef __ANDROID__ #ifndef __ANDROID__
getMounts = System.MountPoints.getMounts getMounts = System.MountPoints.getMounts
-- That will crash when running on Android, so fall back to this.
`catchNonAsync` const System.MountPoints.getProcMounts
#else #else
getMounts = System.MountPoints.getProcMounts getMounts = System.MountPoints.getProcMounts
#endif #endif

View file

@ -33,4 +33,7 @@ https://wiki.termux.com/wiki/Termux:Boot (Integration in place now)
Apparently termux-exec sets a `LD_PRELOAD` that is not compatible, so Apparently termux-exec sets a `LD_PRELOAD` that is not compatible, so
the wrapper script would need to unset it. (Done now) the wrapper script would need to unset it. (Done now)
Webapp mountwatcher crashes "getMounts: does not exist" (caught exception
now))
"""]] """]]