@@ -20,6 +20,7 @@ function indexAction(options: IndexOptions): void {
20
20
const snapshotDir = options . snapshotDir ;
21
21
const environment = options . environment ;
22
22
23
+ const originalWorkdir = process . cwd ( ) ;
23
24
process . chdir ( projectRoot ) ;
24
25
25
26
const outputFile = path . join ( projectRoot , options . output ) ;
@@ -44,6 +45,7 @@ function indexAction(options: IndexOptions): void {
44
45
'\n\nExperienced Fatal Error While Indexing:\nPlease create an issue at github.com/sourcegraph/scip-python:' ,
45
46
e
46
47
) ;
48
+ process . chdir ( originalWorkdir ) ;
47
49
exit ( 1 ) ;
48
50
}
49
51
@@ -67,6 +69,8 @@ function indexAction(options: IndexOptions): void {
67
69
writeSnapshot ( outputPath , obtained ) ;
68
70
}
69
71
}
72
+
73
+ process . chdir ( originalWorkdir ) ;
70
74
}
71
75
72
76
function snapshotAction ( snapshotRoot : string , options : SnapshotOptions ) : void {
@@ -96,6 +100,7 @@ function snapshotAction(snapshotRoot: string, options: SnapshotOptions): void {
96
100
}
97
101
98
102
projectRoot = path . resolve ( projectRoot ) ;
103
+ const originalWorkdir = process . cwd ( ) ;
99
104
process . chdir ( projectRoot ) ;
100
105
101
106
const scipBinaryFile = path . join ( projectRoot , options . output ) ;
@@ -135,6 +140,8 @@ function snapshotAction(snapshotRoot: string, options: SnapshotOptions): void {
135
140
writeSnapshot ( outputPath , obtained ) ;
136
141
}
137
142
}
143
+
144
+ process . chdir ( originalWorkdir ) ;
138
145
}
139
146
}
140
147
0 commit comments