startExternalAddonProcess add parameters
Not used yet but intended to support eg running "rclone gitannex"
This commit is contained in:
parent
631a3ca05d
commit
c64a73c7ea
3 changed files with 7 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
{- External addon processes for special remotes and backends.
|
{- External addon processes for special remotes and backends.
|
||||||
-
|
-
|
||||||
- Copyright 2013-2020 Joey Hess <id@joeyh.name>
|
- Copyright 2013-2024 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU AGPL version 3 or higher.
|
- Licensed under the GNU AGPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -33,16 +33,16 @@ data ExternalAddonStartError
|
||||||
= ProgramNotInstalled String
|
= ProgramNotInstalled String
|
||||||
| ProgramFailure String
|
| ProgramFailure String
|
||||||
|
|
||||||
startExternalAddonProcess :: String -> ExternalAddonPID -> Annex (Either ExternalAddonStartError ExternalAddonProcess)
|
startExternalAddonProcess :: String -> [CommandParam] -> ExternalAddonPID -> Annex (Either ExternalAddonStartError ExternalAddonProcess)
|
||||||
startExternalAddonProcess basecmd pid = do
|
startExternalAddonProcess basecmd ps pid = do
|
||||||
errrelayer <- mkStderrRelayer
|
errrelayer <- mkStderrRelayer
|
||||||
g <- Annex.gitRepo
|
g <- Annex.gitRepo
|
||||||
cmdpath <- liftIO $ searchPath basecmd
|
cmdpath <- liftIO $ searchPath basecmd
|
||||||
liftIO $ start errrelayer g cmdpath
|
liftIO $ start errrelayer g cmdpath
|
||||||
where
|
where
|
||||||
start errrelayer g cmdpath = do
|
start errrelayer g cmdpath = do
|
||||||
(cmd, ps) <- maybe (pure (basecmd, [])) findShellCommand cmdpath
|
(cmd, cmdps) <- maybe (pure (basecmd, [])) findShellCommand cmdpath
|
||||||
let basep = (proc cmd (toCommand ps))
|
let basep = (proc cmd (toCommand (cmdps ++ ps)))
|
||||||
{ std_in = CreatePipe
|
{ std_in = CreatePipe
|
||||||
, std_out = CreatePipe
|
, std_out = CreatePipe
|
||||||
, std_err = CreatePipe
|
, std_err = CreatePipe
|
||||||
|
|
|
@ -215,7 +215,7 @@ poolVar = unsafePerformIO $ newMVar M.empty
|
||||||
-- using it.
|
-- using it.
|
||||||
newExternalState :: ExternalBackendName -> HasExt -> ExternalAddonPID -> Annex ExternalState
|
newExternalState :: ExternalBackendName -> HasExt -> ExternalAddonPID -> Annex ExternalState
|
||||||
newExternalState ebname hasext pid = do
|
newExternalState ebname hasext pid = do
|
||||||
st <- startExternalAddonProcess basecmd pid
|
st <- startExternalAddonProcess basecmd [] pid
|
||||||
st' <- case st of
|
st' <- case st of
|
||||||
Left (ProgramNotInstalled msg) -> warnonce msg >> return st
|
Left (ProgramNotInstalled msg) -> warnonce msg >> return st
|
||||||
Left (ProgramFailure msg) -> warnonce msg >> return st
|
Left (ProgramFailure msg) -> warnonce msg >> return st
|
||||||
|
|
|
@ -658,7 +658,7 @@ startExternal' external = do
|
||||||
n <- succ <$> readTVar (externalLastPid external)
|
n <- succ <$> readTVar (externalLastPid external)
|
||||||
writeTVar (externalLastPid external) n
|
writeTVar (externalLastPid external) n
|
||||||
return n
|
return n
|
||||||
AddonProcess.startExternalAddonProcess basecmd pid >>= \case
|
AddonProcess.startExternalAddonProcess basecmd [] pid >>= \case
|
||||||
Left (AddonProcess.ProgramFailure err) -> do
|
Left (AddonProcess.ProgramFailure err) -> do
|
||||||
unusable err
|
unusable err
|
||||||
Left (AddonProcess.ProgramNotInstalled err) ->
|
Left (AddonProcess.ProgramNotInstalled err) ->
|
||||||
|
|
Loading…
Reference in a new issue