File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
packages/pyright-scip/src Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,11 @@ export function mainCommand(
64
64
. option ( '--project-namespace <namespace>' , 'A prefix to prepend to all module definitions in the current index' )
65
65
. option ( '--cwd <path>' , 'working directory for executing scip-python' , process . cwd ( ) )
66
66
. option ( '--target-only <path>' , 'limit analysis to the following path' )
67
- . option ( '--output <path>' , 'path to the output file' , DEFAULT_OUTPUT_FILE )
67
+ . option (
68
+ '--output <path>' ,
69
+ 'Path to the output file. If this path is relative, it is interpreted relative to the value for --cwd.' ,
70
+ DEFAULT_OUTPUT_FILE
71
+ )
68
72
. option ( '--quiet' , 'run without logging and status information' , false )
69
73
. option (
70
74
'--show-progress-rate-limit <limit>' ,
Original file line number Diff line number Diff line change @@ -22,7 +22,13 @@ function indexAction(options: IndexOptions): void {
22
22
const originalWorkdir = process . cwd ( ) ;
23
23
process . chdir ( projectRoot ) ;
24
24
25
- const outputFile = path . isAbsolute ( options . output ) ? options . output : path . join ( originalWorkdir , options . output ) ;
25
+ // In the relative path case, we use projectRoot rather than
26
+ // originalWorkdir because:
27
+ // 1. To preserve back-compat in case anyone is relying on projectRoot
28
+ // 2. The actual CLI flag for specifying the project root is --cwd,
29
+ // which may lead to the expectation that output is considered
30
+ // relative to the project root.
31
+ const outputFile = path . isAbsolute ( options . output ) ? options . output : path . join ( projectRoot , options . output ) ;
26
32
const output = fs . openSync ( outputFile , 'w' ) ;
27
33
28
34
try {
You can’t perform that action at this time.
0 commit comments