@@ -7,6 +7,7 @@ import * as fs from "node:fs";
7
7
import * as https from "node:https" ;
8
8
import * as zlib from "node:zlib" ;
9
9
import * as tar from "tar" ;
10
+ import { exec } from "node:child_process" ;
10
11
import { registerTaskProvider , executeRazAsTask } from "./taskProvider" ;
11
12
import { executeWithDebuggingSupport , registerDebugCommands } from "./debugger" ;
12
13
@@ -112,8 +113,7 @@ class RazBinaryManager {
112
113
}
113
114
114
115
return new Promise ( ( resolve ) => {
115
- const { exec } = require ( 'child_process' ) ;
116
- exec ( `"${ binaryPath } " --version` , ( error : any , stdout : string , stderr : string ) => {
116
+ exec ( `"${ binaryPath } " --version` , ( error : Error | null , stdout : string , _stderr : string ) => {
117
117
if ( error ) {
118
118
this . outputChannel . appendLine ( `Failed to get binary version: ${ error } ` ) ;
119
119
resolve ( null ) ;
@@ -420,8 +420,7 @@ async function checkForUpdates(context: vscode.ExtensionContext): Promise<void>
420
420
/// Get RAZ version from system PATH
421
421
async function getRazVersion ( ) : Promise < string | null > {
422
422
return new Promise ( ( resolve ) => {
423
- const { exec } = require ( 'child_process' ) ;
424
- exec ( 'raz --version' , ( error : any , stdout : string ) => {
423
+ exec ( 'raz --version' , ( error : Error | null , stdout : string ) => {
425
424
if ( error ) {
426
425
resolve ( null ) ;
427
426
return ;
@@ -622,7 +621,7 @@ export async function activate(
622
621
const binaryManager = new RazBinaryManager ( context , outputChannel ) ;
623
622
const latestVersion = await binaryManager . getLatestVersion ( ) ;
624
623
vscode . env . openExternal ( vscode . Uri . parse ( `https://github.com/codeitlikemiley/raz/releases/tag/${ latestVersion } ` ) ) ;
625
- } catch ( error ) {
624
+ } catch {
626
625
vscode . env . openExternal ( vscode . Uri . parse ( "https://github.com/codeitlikemiley/raz/releases/latest" ) ) ;
627
626
}
628
627
}
@@ -652,10 +651,10 @@ export async function activate(
652
651
// Note: cleanupOldBinaries method may not exist in newer versions
653
652
try {
654
653
const binaryManager = new RazBinaryManager ( context , outputChannel ) ;
655
- if ( typeof ( binaryManager as any ) . cleanupOldBinaries === 'function' ) {
656
- await ( binaryManager as any ) . cleanupOldBinaries ( ) ;
654
+ if ( typeof ( binaryManager as unknown as { cleanupOldBinaries ?: ( ) => Promise < void > } ) . cleanupOldBinaries === 'function' ) {
655
+ await ( binaryManager as unknown as { cleanupOldBinaries : ( ) => Promise < void > } ) . cleanupOldBinaries ( ) ;
657
656
}
658
- } catch ( e ) {
657
+ } catch {
659
658
// Ignore if method doesn't exist
660
659
}
661
660
0 commit comments