-
Notifications
You must be signed in to change notification settings - Fork 47
Windows: scip-python crashes on startup due to unescaped path.sep in RegExp #210
Copy link
Copy link
Open
Description
Summary
scip-python index crashes on Windows before indexing starts because path.sep is used directly in new RegExp(...).
On Windows, path.sep === \, so this produces an invalid regular expression:
Invalid regular expression: /\\/g: \\ at end of pattern
Repro
Environment:
- Windows 11
- Node.js 24.12.0
@sourcegraph/scip-python@0.6.6
Command:
scip-python index --cwd D:\\Development\\Prompsit\\prompsit-api --project-name prompsit-apiObserved stack trace points to packages/pyright-scip/src/virtualenv/PythonEnvironment.ts:
const pathSepRegex = new RegExp(path.sep, 'g');Expected
scip-python should index successfully on Windows.
Root Cause
path.sep must be escaped before it is used as a regex pattern.
Proposed Fix
Replace:
const pathSepRegex = new RegExp(path.sep, 'g');with an escaped variant, for example:
const pathSepRegex = new RegExp(path.sep.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g');I have locally verified that this removes the Windows crash and allows scip-python index to complete on a real project.
Reactions are currently unavailable