public async Task RefreshAsync() { OnStartingRefresh(); try { lock (_fileBitsLock) { if (_isReloadingModules) { RestartFileSystemWatcherTimer(); return; } else { _isReloadingModules = true; } } RootPackage = RootPackageFactory.Create( _fullPathToRootPackageDirectory, _showMissingDevOptionalSubPackages); var command = new NpmBinCommand(_fullPathToRootPackageDirectory, true, PathToNpm); GlobalPackages = (await command.ExecuteAsync()) ? RootPackageFactory.Create(command.BinDirectory) : null; } catch (IOException) { // Can sometimes happen when packages are still installing because the file may still be used by another process } finally { lock (_fileBitsLock) { _isReloadingModules = false; } if (RootPackage == null) { OnOutputLogged("Error - Cannot load local packages."); } if (GlobalPackages == null) { OnOutputLogged("Error - Cannot load global packages."); } OnFinishedRefresh(); } }
public async Task RefreshAsync() { OnStartingRefresh(); try { lock (_fileBitsLock) { if (_isReloadingModules) { RestartFileSystemWatcherTimer(); return; } else { _isReloadingModules = true; } } RootPackage = RootPackageFactory.Create( _fullPathToRootPackageDirectory, _showMissingDevOptionalSubPackages); var command = new NpmBinCommand(_fullPathToRootPackageDirectory, true, PathToNpm); GlobalPackages = (await command.ExecuteAsync()) ? RootPackageFactory.Create(command.BinDirectory) : null; } catch (IOException) { // Can sometimes happen when packages are still installing because the file may still be used by another process } finally { lock (_fileBitsLock) { _isReloadingModules = false; } if (RootPackage == null) { OnOutputLogged("Error - Cannot load local packages."); } if (GlobalPackages == null) { OnOutputLogged("Error - Cannot load global packages."); } OnFinishedRefresh(); } }