Skip to content

Commit 02eaa02

Browse files
committed
Don't change working directory in the indexer
This reverts a change that was added as part of facebookincubator@77681e9 I'm sure there must have been a reason for it, but it breaks running tests in parallel. In general nothing should be changing the working directory, because it's process-wide.
1 parent a832013 commit 02eaa02

1 file changed

Lines changed: 1 addition & 16 deletions

File tree

  • glean/lang/clang/Glean/Indexer

glean/lang/clang/Glean/Indexer/Cpp.hs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ import Glean.LocalOrRemote ( BackendKind(..),
5454
import Glean.Util.Service
5555
import qualified Glean.Interprocess.Worklist as Worklist
5656
import qualified Glean.Handler as GleanHandler
57-
import System.Posix (changeWorkingDirectory)
5857
import Data.Aeson (decode, Object, Value (String))
5958
import Data.Foldable (toList)
6059

@@ -225,13 +224,10 @@ indexerWith deriveToo = Indexer {
225224
, "--worker_index", show i
226225
, "--worker_count", show workers
227226
]
228-
currentDir <- getCurrentDirectory
229-
let cdUp = not $ isPathPrefixOf currentDir buildDir
230227
forConcurrently_ [0 .. workers-1] $ \i -> bracket
231228
-- createProcess_ because we don't want the stdout/stderr handles
232229
-- to be closed
233-
( (if cdUp then pushd ".." else id) $
234-
createProcess_
230+
(createProcess_
235231
"Cpp.index"
236232
(proc clangIndex $ workerargs i)
237233
{std_out = stream, std_err = stream})
@@ -246,17 +242,6 @@ indexerWith deriveToo = Indexer {
246242
-- return data file names
247243
return $ map dataFile [0 .. workers-1]
248244

249-
isPathPrefixOf :: FilePath -> FilePath -> Bool
250-
isPathPrefixOf prefix path = prefix == take (length prefix) path
251-
252-
pushd :: FilePath -> IO a -> IO a
253-
pushd dir f = do
254-
currentDir <- getCurrentDirectory
255-
changeWorkingDirectory dir
256-
res <- f
257-
changeWorkingDirectory currentDir
258-
pure res
259-
260245
writeToDB backend repo = mapM_ $ \dataFile -> do
261246
dat <- BS.readFile dataFile
262247
case deserializeGen (Proxy :: Proxy Compact) dat of

0 commit comments

Comments
 (0)