cannot open file:// url on Android, so don't use the htmlshim there
This commit is contained in:
parent
63cc47dd51
commit
1e9b8e1467
1 changed files with 13 additions and 6 deletions
|
@ -66,7 +66,7 @@ start' allowauto listenhost = do
|
||||||
\origout origerr url htmlshim ->
|
\origout origerr url htmlshim ->
|
||||||
if isJust listenhost
|
if isJust listenhost
|
||||||
then maybe noop (`hPutStrLn` url) origout
|
then maybe noop (`hPutStrLn` url) origout
|
||||||
else openBrowser browser htmlshim origout origerr
|
else openBrowser browser htmlshim url origout origerr
|
||||||
)
|
)
|
||||||
auto
|
auto
|
||||||
| allowauto = liftIO startNoRepo
|
| allowauto = liftIO startNoRepo
|
||||||
|
@ -141,7 +141,7 @@ firstRun listenhost = do
|
||||||
go
|
go
|
||||||
| otherwise = do
|
| otherwise = do
|
||||||
browser <- maybe Nothing webBrowser <$> Git.Config.global
|
browser <- maybe Nothing webBrowser <$> Git.Config.global
|
||||||
openBrowser browser htmlshim Nothing Nothing
|
openBrowser browser htmlshim url Nothing Nothing
|
||||||
go
|
go
|
||||||
where
|
where
|
||||||
go = do
|
go = do
|
||||||
|
@ -152,8 +152,8 @@ firstRun listenhost = do
|
||||||
sendurlback v
|
sendurlback v
|
||||||
sendurlback v _origout _origerr url _htmlshim = putMVar v url
|
sendurlback v _origout _origerr url _htmlshim = putMVar v url
|
||||||
|
|
||||||
openBrowser :: Maybe FilePath -> FilePath -> Maybe Handle -> Maybe Handle -> IO ()
|
openBrowser :: Maybe FilePath -> FilePath -> String -> Maybe Handle -> Maybe Handle -> IO ()
|
||||||
openBrowser mcmd htmlshim outh errh = do
|
openBrowser mcmd htmlshim realurl outh errh = do
|
||||||
hPutStrLn (fromMaybe stdout outh) $ "Launching web browser on " ++ url
|
hPutStrLn (fromMaybe stdout outh) $ "Launching web browser on " ++ url
|
||||||
hFlush stdout
|
hFlush stdout
|
||||||
environ <- cleanEnvironment
|
environ <- cleanEnvironment
|
||||||
|
@ -166,10 +166,17 @@ openBrowser mcmd htmlshim outh errh = do
|
||||||
unless (exitcode == ExitSuccess) $
|
unless (exitcode == ExitSuccess) $
|
||||||
hPutStrLn (fromMaybe stderr errh) "failed to start web browser"
|
hPutStrLn (fromMaybe stderr errh) "failed to start web browser"
|
||||||
where
|
where
|
||||||
url = fileUrl htmlshim
|
|
||||||
p = case mcmd of
|
p = case mcmd of
|
||||||
Just cmd -> proc cmd [htmlshim]
|
Just cmd -> proc cmd [htmlshim]
|
||||||
Nothing -> browserProc htmlshim
|
Nothing -> browserProc htmlshim url
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
{- Android does not support file:// urls, but neither is
|
||||||
|
- the security of the url in the process table important
|
||||||
|
- there, so just use the real url. -}
|
||||||
|
url = realurl
|
||||||
|
#else
|
||||||
|
url = fileUrl htmlshim
|
||||||
|
#endif
|
||||||
|
|
||||||
{- web.browser is a generic git config setting for a web browser program -}
|
{- web.browser is a generic git config setting for a web browser program -}
|
||||||
webBrowser :: Git.Repo -> Maybe FilePath
|
webBrowser :: Git.Repo -> Maybe FilePath
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue