@@ -6,6 +6,7 @@ import { exec } from "child_process";
66import * as net from "net" ;
77import { promisify } from "util" ;
88import { ClabLabTreeNode } from "../treeView/common" ;
9+ import { containerlabBinaryPath } from "../extension" ;
910
1011const execAsync = promisify ( exec ) ;
1112
@@ -207,7 +208,7 @@ async function tryRunAsGroupMember(
207208async function hasPasswordlessSudo ( checkType : 'generic' | 'containerlab' | 'docker' ) : Promise < boolean > {
208209 let checkCommand : string ;
209210 if ( checkType === 'containerlab' ) {
210- checkCommand = " sudo -n containerlab version >/dev/null 2>&1 && echo true || echo false" ;
211+ checkCommand = ` sudo -n ${ containerlabBinaryPath } version >/dev/null 2>&1 && echo true || echo false` ;
211212 } else if ( checkType === 'docker' ) {
212213 checkCommand = "sudo -n docker ps >/dev/null 2>&1 && echo true || echo false" ;
213214 } else {
@@ -410,10 +411,10 @@ export async function checkAndUpdateClabIfNeeded(
410411 context : vscode . ExtensionContext
411412) : Promise < void > {
412413 try {
413- log ( ' Running "containerlab version check".' , outputChannel ) ;
414+ log ( ` Running "${ containerlabBinaryPath } version check".` , outputChannel ) ;
414415 // Run the version check via runWithSudo and capture output.
415416 const versionOutputRaw = await runWithSudo (
416- 'containerlab version check' ,
417+ ` ${ containerlabBinaryPath } version check` ,
417418 'containerlab version check' ,
418419 outputChannel ,
419420 'containerlab' ,
@@ -436,7 +437,7 @@ export async function checkAndUpdateClabIfNeeded(
436437 context . subscriptions . push (
437438 vscode . commands . registerCommand ( updateCommandId , async ( ) => {
438439 try {
439- await runWithSudo ( 'containerlab version upgrade' , 'Upgrading containerlab' , outputChannel , 'generic' ) ;
440+ await runWithSudo ( ` ${ containerlabBinaryPath } version upgrade` , 'Upgrading containerlab' , outputChannel , 'generic' ) ;
440441 vscode . window . showInformationMessage ( 'Containerlab updated successfully!' ) ;
441442 log ( 'Containerlab updated successfully.' , outputChannel ) ;
442443 } catch ( err : any ) {
0 commit comments