From c64a73c7eaafdff60e42e61c606b015c4f9c1a35 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Apr 2024 13:09:10 -0400 Subject: [PATCH] startExternalAddonProcess add parameters Not used yet but intended to support eg running "rclone gitannex" --- Annex/ExternalAddonProcess.hs | 10 +++++----- Backend/External.hs | 2 +- Remote/External.hs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Annex/ExternalAddonProcess.hs b/Annex/ExternalAddonProcess.hs index 6166fab5a7..e573d2261d 100644 --- a/Annex/ExternalAddonProcess.hs +++ b/Annex/ExternalAddonProcess.hs @@ -1,6 +1,6 @@ {- External addon processes for special remotes and backends. - - - Copyright 2013-2020 Joey Hess + - Copyright 2013-2024 Joey Hess - - 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 diff --git a/Backend/External.hs b/Backend/External.hs index b95cff5e3b..53416c7e4b 100644 --- a/Backend/External.hs +++ b/Backend/External.hs @@ -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 diff --git a/Remote/External.hs b/Remote/External.hs index 99b49d0356..179043c3bc 100644 --- a/Remote/External.hs +++ b/Remote/External.hs @@ -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) ->