()
| 290 | } |
| 291 | |
| 292 | export async function checkGlobalInstallPermissions(): Promise<{ |
| 293 | hasPermissions: boolean |
| 294 | npmPrefix: string | null |
| 295 | }> { |
| 296 | try { |
| 297 | const prefix = await getInstallationPrefix() |
| 298 | if (!prefix) { |
| 299 | return { hasPermissions: false, npmPrefix: null } |
| 300 | } |
| 301 | |
| 302 | try { |
| 303 | await access(prefix, fsConstants.W_OK) |
| 304 | return { hasPermissions: true, npmPrefix: prefix } |
| 305 | } catch { |
| 306 | logError( |
| 307 | new AutoUpdaterError( |
| 308 | 'Insufficient permissions for global npm install.', |
| 309 | ), |
| 310 | ) |
| 311 | return { hasPermissions: false, npmPrefix: prefix } |
| 312 | } |
| 313 | } catch (error) { |
| 314 | logError(error as Error) |
| 315 | return { hasPermissions: false, npmPrefix: null } |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | export async function getLatestVersion( |
| 320 | channel: ReleaseChannel, |
no test coverage detected