Skip to content

Commit

Permalink
Fix #1016: PowerShell extension doesn't load due to extension conflict
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
daviwil committed Sep 13, 2017
1 parent 2c6e76f commit 43c6cc3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,14 @@ export class Logger {

this.logChannel.appendLine(timestampedMessage);
if (this.logFilePath) {
fs.appendFile(this.logFilePath, timestampedMessage + os.EOL);
fs.appendFile(
this.logFilePath,
timestampedMessage + os.EOL,
err => {
if (err) {
console.log(`Error writing to vscode-powershell log file: ${err}`)
}
});
}
}
}
Expand Down

0 comments on commit 43c6cc3

Please sign in to comment.