@@ -20,6 +20,7 @@ function indexAction(options: IndexOptions): void {
2020 const snapshotDir = options . snapshotDir ;
2121 const environment = options . environment ;
2222
23+ const originalWorkdir = process . cwd ( ) ;
2324 process . chdir ( projectRoot ) ;
2425
2526 const outputFile = path . join ( projectRoot , options . output ) ;
@@ -44,6 +45,7 @@ function indexAction(options: IndexOptions): void {
4445 '\n\nExperienced Fatal Error While Indexing:\nPlease create an issue at github.com/sourcegraph/scip-python:' ,
4546 e
4647 ) ;
48+ process . chdir ( originalWorkdir ) ;
4749 exit ( 1 ) ;
4850 }
4951
@@ -67,6 +69,8 @@ function indexAction(options: IndexOptions): void {
6769 writeSnapshot ( outputPath , obtained ) ;
6870 }
6971 }
72+
73+ process . chdir ( originalWorkdir ) ;
7074}
7175
7276function snapshotAction ( snapshotRoot : string , options : SnapshotOptions ) : void {
@@ -96,6 +100,7 @@ function snapshotAction(snapshotRoot: string, options: SnapshotOptions): void {
96100 }
97101
98102 projectRoot = path . resolve ( projectRoot ) ;
103+ const originalWorkdir = process . cwd ( ) ;
99104 process . chdir ( projectRoot ) ;
100105
101106 const scipBinaryFile = path . join ( projectRoot , options . output ) ;
@@ -135,6 +140,8 @@ function snapshotAction(snapshotRoot: string, options: SnapshotOptions): void {
135140 writeSnapshot ( outputPath , obtained ) ;
136141 }
137142 }
143+
144+ process . chdir ( originalWorkdir ) ;
138145 }
139146}
140147
0 commit comments