Skip to content

Commit 9a052a5

Browse files
fix: Allow path handling for --output (sourcegraph#118)
1. Allow an absolute path. 2. If the path is relative, it should be interpreted relative to the original working directory, not the project root.
1 parent 05bc904 commit 9a052a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/pyright-scip/src/main-impl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function indexAction(options: IndexOptions): void {
2222
const originalWorkdir = process.cwd();
2323
process.chdir(projectRoot);
2424

25-
const outputFile = path.join(projectRoot, options.output);
25+
const outputFile = path.isAbsolute(options.output) ? options.output : path.join(originalWorkdir, options.output);
2626
const output = fs.openSync(outputFile, 'w');
2727

2828
try {
@@ -75,7 +75,7 @@ function snapshotAction(snapshotRoot: string, options: SnapshotOptions): void {
7575
projectNamespace: options.projectNamespace,
7676
environment: options.environment ? path.resolve(options.environment) : undefined,
7777
dev: options.dev,
78-
output: options.output,
78+
output: path.join(projectRoot, options.output),
7979
cwd: projectRoot,
8080
targetOnly: options.targetOnly,
8181
infer: { projectVersionFromCommit: false },

0 commit comments

Comments
 (0)