Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions glean/lang/clang/Glean/Indexer/Cpp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import Glean.LocalOrRemote ( BackendKind(..),
import Glean.Util.Service
import qualified Glean.Interprocess.Worklist as Worklist
import qualified Glean.Handler as GleanHandler
import System.Posix (changeWorkingDirectory)
import Data.Aeson (decode, Object, Value (String))
import Data.Foldable (toList)

Expand Down Expand Up @@ -225,13 +224,10 @@ indexerWith deriveToo = Indexer {
, "--worker_index", show i
, "--worker_count", show workers
]
currentDir <- getCurrentDirectory
let cdUp = not $ isPathPrefixOf currentDir buildDir
forConcurrently_ [0 .. workers-1] $ \i -> bracket
-- createProcess_ because we don't want the stdout/stderr handles
-- to be closed
( (if cdUp then pushd ".." else id) $
createProcess_
(createProcess_
"Cpp.index"
(proc clangIndex $ workerargs i)
{std_out = stream, std_err = stream})
Expand All @@ -246,17 +242,6 @@ indexerWith deriveToo = Indexer {
-- return data file names
return $ map dataFile [0 .. workers-1]

isPathPrefixOf :: FilePath -> FilePath -> Bool
isPathPrefixOf prefix path = prefix == take (length prefix) path

pushd :: FilePath -> IO a -> IO a
pushd dir f = do
currentDir <- getCurrentDirectory
changeWorkingDirectory dir
res <- f
changeWorkingDirectory currentDir
pure res

writeToDB backend repo = mapM_ $ \dataFile -> do
dat <- BS.readFile dataFile
case deserializeGen (Proxy :: Proxy Compact) dat of
Expand Down
Loading