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.
|
||||
-
|
||||
- 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.
|
||||
-}
|
||||
|
@ -33,16 +33,16 @@ data ExternalAddonStartError
|
|||
= ProgramNotInstalled String
|
||||
| ProgramFailure String
|
||||
|
||||
startExternalAddonProcess :: String -> ExternalAddonPID -> Annex (Either ExternalAddonStartError ExternalAddonProcess)
|
||||
startExternalAddonProcess basecmd pid = do
|
||||
startExternalAddonProcess :: String -> [CommandParam] -> ExternalAddonPID -> Annex (Either ExternalAddonStartError ExternalAddonProcess)
|
||||
startExternalAddonProcess basecmd ps pid = do
|
||||
errrelayer <- mkStderrRelayer
|
||||
g <- Annex.gitRepo
|
||||
cmdpath <- liftIO $ searchPath basecmd
|
||||
liftIO $ start errrelayer g cmdpath
|
||||
where
|
||||
start errrelayer g cmdpath = do
|
||||
(cmd, ps) <- maybe (pure (basecmd, [])) findShellCommand cmdpath
|
||||
let basep = (proc cmd (toCommand ps))
|
||||
(cmd, cmdps) <- maybe (pure (basecmd, [])) findShellCommand cmdpath
|
||||
let basep = (proc cmd (toCommand (cmdps ++ ps)))
|
||||
{ std_in = CreatePipe
|
||||
, std_out = CreatePipe
|
||||
, std_err = CreatePipe
|
||||
|
|
|
@ -215,7 +215,7 @@ poolVar = unsafePerformIO $ newMVar M.empty
|
|||
-- using it.
|
||||
newExternalState :: ExternalBackendName -> HasExt -> ExternalAddonPID -> Annex ExternalState
|
||||
newExternalState ebname hasext pid = do
|
||||
st <- startExternalAddonProcess basecmd pid
|
||||
st <- startExternalAddonProcess basecmd [] pid
|
||||
st' <- case st of
|
||||
Left (ProgramNotInstalled msg) -> warnonce msg >> return st
|
||||
Left (ProgramFailure msg) -> warnonce msg >> return st
|
||||
|
|
|
@ -658,7 +658,7 @@ startExternal' external = do
|
|||
n <- succ <$> readTVar (externalLastPid external)
|
||||
writeTVar (externalLastPid external) n
|
||||
return n
|
||||
AddonProcess.startExternalAddonProcess basecmd pid >>= \case
|
||||
AddonProcess.startExternalAddonProcess basecmd [] pid >>= \case
|
||||
Left (AddonProcess.ProgramFailure err) -> do
|
||||
unusable err
|
||||
Left (AddonProcess.ProgramNotInstalled err) ->
|
||||
|
|
Loading…
Reference in a new issue