avoid uname -o on !linux and catch any exception from it

Fix bug in last release that prevented the webapp opening on non-Linux systems.

This commit was sponsored by Jake Vosloo on Patreon.
This commit is contained in:
Joey Hess 2018-05-08 14:06:19 -04:00
parent b2e03bb428
commit 2948f6d916
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 24 additions and 2 deletions

View file

@ -1,3 +1,5 @@
{-# LANGUAGE CPP #-}
{- Android stuff
-
- Copyright 2018 Joey Hess <id@joeyh.name>
@ -14,4 +16,9 @@ import Common
-- Note that this relies on termux's uname having been built with "Android"
-- as the os name. Often on Android, uname will report "Linux".
osAndroid :: IO Bool
osAndroid = ("Android" `isPrefixOf` ) <$> readProcess "uname" ["-o"]
#ifdef linux_HOST_OS
osAndroid = catchDefaultIO False $
("Android" `isPrefixOf` ) <$> readProcess "uname" ["-o"]
#else
osAndroid = return False
#endif