Skip to content

Commit 8724360

Browse files
committed
Fix TypeError from trying to read directory
1 parent 22d6792 commit 8724360

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/extension/noConfigDebugInit.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,21 @@ export async function registerNoConfigDebug(
8787
);
8888

8989
// create file system watcher for the debuggerAdapterEndpointFolder for when the communication port is written
90-
const fileSystemWatcher = createFileSystemWatcher(new RelativePattern(tempDirPath, '**/*'));
90+
const fileSystemWatcher = createFileSystemWatcher(new RelativePattern(tempDirPath, '**/*.txt'));
9191
const fileCreationEvent = fileSystemWatcher.onDidCreate(async (uri) => {
9292
sendTelemetryEvent(EventName.DEBUG_SESSION_START, undefined, {
9393
trigger: 'noConfig' as TriggerType,
9494
});
9595

9696
const filePath = uri.fsPath;
9797
fs.readFile(filePath, (err, data) => {
98-
const dataParse = data.toString();
9998
if (err) {
10099
traceError(`Error reading debuggerAdapterEndpoint.txt file: ${err}`);
101100
return;
102101
}
103102
try {
104103
// parse the client port
104+
const dataParse = data.toString();
105105
const jsonData = JSON.parse(dataParse);
106106
const clientPort = jsonData.client?.port;
107107
traceVerbose(`Parsed client port: ${clientPort}`);

src/test/unittest/noConfigDebugInit.unit.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ suite('setup for no-config debug scenario', function () {
9999

100100
// Assert
101101
sinon.assert.calledOnce(createFileSystemWatcherFunct);
102-
const expectedPattern = new RelativePattern(path.join(os.tmpdir(), '.noConfigDebugAdapterEndpoints'), '**/*');
102+
const expectedPattern = new RelativePattern(path.join(os.tmpdir(), '.noConfigDebugAdapterEndpoints'), '**/*.txt');
103103
sinon.assert.calledWith(createFileSystemWatcherFunct, expectedPattern);
104104
});
105105

0 commit comments

Comments
 (0)