Skip to content

Commit a87d052

Browse files
committed
Fix #1016: PowerShell extension doesn't load due to extension conflict
This change fixes an issue that was illuminated by the AzureRM Tools extension where the `fs.appendFile` method provided by Node.js was not being called with the correct number of parameters. The AzureRM Tools extension loads up the AppInsights SDK for Node.js which in turn loads a module called Zone.js. Zone.js replaces built-in Node.js modules like `fs` to instrument their function calls. The instrumented version of that module was not as permissive on our missing `appendFile` parameter so it threw an exception which ultimately prevented the PowerShell extension from loading. This issue was fixed by populating the `callback` parameter of the `appendFile` function so that the instrumented wrapper operates correctly.
1 parent 9097e9d commit a87d052

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/logging.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,14 @@ export class Logger {
142142

143143
this.logChannel.appendLine(timestampedMessage);
144144
if (this.logFilePath) {
145-
fs.appendFile(this.logFilePath, timestampedMessage + os.EOL);
145+
fs.appendFile(
146+
this.logFilePath,
147+
timestampedMessage + os.EOL,
148+
err => {
149+
if (err) {
150+
console.log(`Error writing to vscode-powershell log file: ${err}`)
151+
}
152+
});
146153
}
147154
}
148155
}

0 commit comments

Comments
 (0)