Skip to content

Commit

Permalink
Fix #23
Browse files Browse the repository at this point in the history
Fix updating Aspire workload on macOS and Linux
  • Loading branch information
rafaelldi committed Jan 2, 2024
1 parent 375e415 commit 7804e04
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
- Metrics table and chart
- Troubleshooting page in the docs

### Fixed
- [#23](https://github.com/rafaelldi/aspire-plugin/issues/23): Aspire workload update on macOS and Linux

## [0.1.2] - 2023-12-21

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.options.ShowSettingsUtil
import com.intellij.openapi.project.Project
import com.intellij.openapi.rd.util.withUiContext
import com.intellij.openapi.util.SystemInfo
import com.intellij.platform.ide.progress.withBackgroundProgress
import com.jetbrains.rider.runtime.RiderDotNetActiveRuntimeHost
import kotlinx.coroutines.CoroutineScope
Expand Down Expand Up @@ -110,7 +111,7 @@ class AspireWorkloadService(private val project: Project, private val scope: Cor
Notification(
"Aspire",
AspireBundle.message("notifications.aspire.workload.update.failed"),
"",
output.stderr,
NotificationType.WARNING
)
.notify(project)
Expand Down Expand Up @@ -177,7 +178,12 @@ class AspireWorkloadService(private val project: Project, private val scope: Cor
.withParameters("workload", "update")

try {
return ExecUtil.execAndGetOutput(commandLine)
return if (SystemInfo.isWindows) {
ExecUtil.execAndGetOutput(commandLine, 30_000)
} else {
val sudoCommand = ExecUtil.sudoCommand(commandLine, AspireBundle.getMessage("notification.aspire.workload.update.elevated"))
ExecUtil.execAndGetOutput(sudoCommand, 30_000)
}
} catch (e: Exception) {
LOG.warn("Unable to update workload list")
return null
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/messages/AspireBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ notifications.update.aspire.workload=Update Aspire workload
notifications.do.not.check.for.updates=Do not check for updates
notifications.aspire.workload.updated=Aspire workload is successfully updated
notifications.aspire.workload.update.failed=Aspire workload update failed
notification.aspire.workload.update.elevated=Rider needs elevated permissions to update workload

service.tab.information=Information
service.tab.information.name=Name:
Expand Down

0 comments on commit 7804e04

Please sign in to comment.