diff --git a/extensions/debug-auto-launch/src/extension.ts b/extensions/debug-auto-launch/src/extension.ts index f3527df7125..b70fb3dedbe 100644 --- a/extensions/debug-auto-launch/src/extension.ts +++ b/extensions/debug-auto-launch/src/extension.ts @@ -191,14 +191,22 @@ const transitions: { [S in State]: StateTransition } = { const server = await new Promise((resolve, reject) => { const s = createServer((socket) => { let data: Buffer[] = []; - socket.on('data', (chunk) => data.push(chunk)); - socket.on('end', async () => { + socket.on('data', async (chunk) => { + if (chunk[chunk.length - 1] !== 0) { // terminated with NUL byte + data.push(chunk); + return; + } + + data.push(chunk.slice(0, -1)); + try { await vscode.commands.executeCommand( 'extension.js-debug.autoAttachToProcess', JSON.parse(Buffer.concat(data).toString()) ); + socket.write(Buffer.from([0])); } catch (err) { + socket.write(Buffer.from([1])); console.error(err); } }); diff --git a/product.json b/product.json index b72e7e53dee..c6c74ce1f22 100644 --- a/product.json +++ b/product.json @@ -91,7 +91,7 @@ }, { "name": "ms-vscode.js-debug", - "version": "1.49.0", + "version": "1.49.2", "repo": "https://github.com/Microsoft/vscode-js-debug", "metadata": { "id": "25629058-ddac-4e17-abba-74678e126c5d",