@@ -241,7 +241,7 @@ public async Task<List<WinGetPackage>> SearchPackageAsync(string packageId, stri
241241 /// </exception>
242242 public List < WinGetPackage > GetInstalledPackages ( )
243243 {
244- ProcessResult result = Execute ( _listCmd ) ;
244+ ProcessResult result = Execute ( AcceptSourceAgreements ( _listCmd ) ) ;
245245
246246 return ProcessOutputReader . ToPackageList ( result . Output , PackageAction . InstalledList ) ;
247247 }
@@ -269,7 +269,7 @@ public List<WinGetPackage> GetInstalledPackages(string packageId, bool exact = f
269269 {
270270 ArgsHelper . ThrowIfStringIsNullOrWhiteSpace ( packageId , "packageId" ) ;
271271
272- string cmd = string . Format ( _searchInstalledCmd , packageId ) ;
272+ string cmd = string . Format ( AcceptSourceAgreements ( _searchInstalledCmd ) , packageId ) ;
273273
274274 if ( exact )
275275 {
@@ -308,7 +308,7 @@ public List<WinGetPackage> GetInstalledPackages(string packageId, string sourceN
308308 ArgsHelper . ThrowIfStringIsNullOrWhiteSpace ( packageId , "packageId" ) ;
309309 ArgsHelper . ThrowIfStringIsNullOrWhiteSpace ( sourceName , "sourceName" ) ;
310310
311- string cmd = string . Format ( _searchInstalledBySourceCmd , packageId , sourceName ) ;
311+ string cmd = string . Format ( AcceptSourceAgreements ( _searchInstalledBySourceCmd ) , packageId , sourceName ) ;
312312
313313 if ( exact )
314314 {
@@ -335,7 +335,7 @@ public List<WinGetPackage> GetInstalledPackages(string packageId, string sourceN
335335 /// </exception>
336336 public async Task < List < WinGetPackage > > GetInstalledPackagesAsync ( CancellationToken cancellationToken = default )
337337 {
338- ProcessResult result = await ExecuteAsync ( _listCmd , false , cancellationToken ) ;
338+ ProcessResult result = await ExecuteAsync ( AcceptSourceAgreements ( _listCmd ) , false , cancellationToken ) ;
339339
340340 // Return empty list if the task was cancled
341341 if ( cancellationToken . IsCancellationRequested )
@@ -373,7 +373,7 @@ public async Task<List<WinGetPackage>> GetInstalledPackagesAsync(string packageI
373373 {
374374 ArgsHelper . ThrowIfStringIsNullOrWhiteSpace ( packageId , "packageId" ) ;
375375
376- string cmd = string . Format ( _searchInstalledCmd , packageId ) ;
376+ string cmd = string . Format ( AcceptSourceAgreements ( _searchInstalledCmd ) , packageId ) ;
377377
378378 if ( exact )
379379 {
@@ -422,7 +422,7 @@ public async Task<List<WinGetPackage>> GetInstalledPackagesAsync(string packageI
422422 ArgsHelper . ThrowIfStringIsNullOrWhiteSpace ( packageId , "packageId" ) ;
423423 ArgsHelper . ThrowIfStringIsNullOrWhiteSpace ( sourceName , "sourceName" ) ;
424424
425- string cmd = string . Format ( _searchInstalledBySourceCmd , packageId , sourceName ) ;
425+ string cmd = string . Format ( AcceptSourceAgreements ( _searchInstalledBySourceCmd ) , packageId , sourceName ) ;
426426
427427 if ( exact )
428428 {
0 commit comments