diff --git a/src/features/CodeActions.ts b/src/features/CodeActions.ts index 825b7941a9..ff33097917 100644 --- a/src/features/CodeActions.ts +++ b/src/features/CodeActions.ts @@ -27,7 +27,7 @@ export class CodeActionsFeature implements vscode.Disposable { private async showRuleDocumentation(ruleId: string): Promise { const pssaDocBaseURL = - "https://docs.microsoft.com/powershell/utility-modules/psscriptanalyzer/rules/"; + "https://learn.microsoft.com/powershell/utility-modules/psscriptanalyzer/rules/"; if (!ruleId) { this.log.writeWarning( diff --git a/src/platform.ts b/src/platform.ts index c1037e05f9..ba78b7f0d7 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -755,21 +755,6 @@ export class PowerShellExeFinder { } } -export function getWindowsSystemPowerShellPath( - systemFolderName: string, -): string | undefined { - if (process.env.windir === undefined) { - return undefined; - } else - return path.join( - process.env.windir, - systemFolderName, - "WindowsPowerShell", - "v1.0", - "powershell.exe", - ); -} - interface IPossiblePowerShellExe extends IPowerShellExeDetails { exists(): Promise; readonly suppressWarning: boolean; diff --git a/src/session.ts b/src/session.ts index adcb815e4f..1c3585d1e4 100644 --- a/src/session.ts +++ b/src/session.ts @@ -385,10 +385,16 @@ export class SessionManager implements Middleware { const fs = vscode.workspace.fs; const pid = (await pwshProcess.getPid())!.toString(); await fs.writeFile(pidFilePath, Buffer.from(pid)); - const deletePidOnExit = pwshProcess.onExited(() => { + const deletePidOnExit = pwshProcess.onExited(async () => { deletePidOnExit.dispose(); - fs.delete(pidFilePath, { useTrash: false }); - console.log(`Deleted PID file: ${pidFilePath}`); + try { + await fs.delete(pidFilePath, { useTrash: false }); + this.logger.writeDebug(`Deleted PID file: ${pidFilePath}`); + } catch (err) { + this.logger.writeError( + `Error occurred while deleting PID file:\n${err}`, + ); + } }); this.registeredCommands.push(deletePidOnExit); this.extensionContext.subscriptions.push(deletePidOnExit); diff --git a/src/utils.ts b/src/utils.ts index e29a5f3807..5e7ec6d738 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -96,11 +96,6 @@ export async function readDirectory( return items.map(([name, _type]) => name); } -export function getTimestampString(): string { - const time = new Date(); - return `[${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}]`; -} - export function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); }