Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix updating Aspire workload on macOS and Linux #25

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading