diff --git a/internal/locale/locales/en-us.yaml b/internal/locale/locales/en-us.yaml index af8ddd2cad..d5475f5f0b 100644 --- a/internal/locale/locales/en-us.yaml +++ b/internal/locale/locales/en-us.yaml @@ -187,9 +187,10 @@ run_description: other: Run your project scripts scripts_description: other: Show project scripts -runtime_setup_in_use_err: +runtime_setup_in_use_warning: other: | - Could not update your runtime as it is currently in use. Please stop any active runtime processes and try again. State Tool found the following processes to be using the runtime: + [WARNING]Warning:[/RESET] the runtime for this project is in use, it is recommended you restart any active processes to avoid conflicts. + The following processes are currently using this runtime: {{.V0}} runtime_alternative_file_transforms_err: other: "Could not apply necessary file transformations after unpacking." diff --git a/internal/runbits/runtime/rationalize.go b/internal/runbits/runtime/rationalize.go index 3feac4ac8d..329011ea96 100644 --- a/internal/runbits/runtime/rationalize.go +++ b/internal/runbits/runtime/rationalize.go @@ -6,7 +6,6 @@ import ( "strings" "github.com/ActiveState/cli/internal/errs" - "github.com/ActiveState/cli/internal/graph" "github.com/ActiveState/cli/internal/locale" buildscript_runbit "github.com/ActiveState/cli/internal/runbits/buildscript" "github.com/ActiveState/cli/internal/runbits/rationalize" @@ -22,14 +21,6 @@ var ErrBuildscriptNotExist = buildscript_runbit.ErrBuildscriptNotExist var ErrBuildScriptNeedsCommit = errors.New("buildscript is dirty, need to run state commit") -type RuntimeInUseError struct { - Processes []*graph.ProcessInfo -} - -func (err RuntimeInUseError) Error() string { - return "runtime is in use" -} - func rationalizeUpdateError(prime primeable, rerr *error) { if *rerr == nil { return @@ -37,7 +28,6 @@ func rationalizeUpdateError(prime primeable, rerr *error) { var artifactCachedBuildErr *runtime.ArtifactCachedBuildFailed var artifactBuildErr *runtime.ArtifactBuildError - var runtimeInUseErr *RuntimeInUseError switch { // Artifact cached build errors @@ -60,17 +50,6 @@ func rationalizeUpdateError(prime primeable, rerr *error) { errs.SetInput(), ) - // Runtime in use - case errors.As(*rerr, &runtimeInUseErr): - list := []string{} - for _, proc := range runtimeInUseErr.Processes { - list = append(list, fmt.Sprintf(" - %s (process: %d)", proc.Exe, proc.Pid)) - } - *rerr = errs.WrapUserFacing(*rerr, - locale.Tr("runtime_setup_in_use_err", strings.Join(list, "\n")), - errs.SetInput(), - ) - // Headless case errors.Is(*rerr, rationalize.ErrHeadless): *rerr = errs.WrapUserFacing(*rerr, diff --git a/internal/runbits/runtime/runtime.go b/internal/runbits/runtime/runtime.go index 88305f47a6..4fd3a8544d 100644 --- a/internal/runbits/runtime/runtime.go +++ b/internal/runbits/runtime/runtime.go @@ -1,8 +1,10 @@ package runtime_runbit import ( + "fmt" "net/url" "os" + "strings" anaConsts "github.com/ActiveState/cli/internal/analytics/constants" "github.com/ActiveState/cli/internal/analytics/dimensions" @@ -236,7 +238,11 @@ func Update( defer cancel() if procs, err := prime.SvcModel().GetProcessesInUse(ctx, rt.Env(false).ExecutorsPath); err == nil { if len(procs) > 0 { - return nil, &RuntimeInUseError{procs} + list := []string{} + for _, proc := range procs { + list = append(list, fmt.Sprintf(" - %s (process: %d)", proc.Exe, proc.Pid)) + } + prime.Output().Notice(locale.Tr("runtime_setup_in_use_warning", strings.Join(list, "\n"))) } } else { multilog.Error("Unable to determine if runtime is in use: %v", errs.JoinMessage(err)) diff --git a/test/integration/runtime_int_test.go b/test/integration/runtime_int_test.go index cb22734c18..aa9671d0ce 100644 --- a/test/integration/runtime_int_test.go +++ b/test/integration/runtime_int_test.go @@ -113,6 +113,10 @@ func (suite *RuntimeIntegrationTestSuite) TestInterruptSetup() { } func (suite *RuntimeIntegrationTestSuite) TestInUse() { + if runtime.GOOS == "windows" { + // https://activestatef.atlassian.net/browse/DX-2926 + suite.T().Skip("interrupting on windows is currently broken when ran via CI") + } if runtime.GOOS == "darwin" { return // gopsutil errors on later versions of macOS (DX-2723) } @@ -128,10 +132,9 @@ func (suite *RuntimeIntegrationTestSuite) TestInUse() { time.Sleep(1 * time.Second) // allow time for perl to start up cp2 := ts.Spawn("install", "DateTime") - cp2.Expect("currently in use", e2e.RuntimeSourcingTimeoutOpt) + cp2.Expect("the runtime for this project is in use", e2e.RuntimeSourcingTimeoutOpt) cp2.Expect("perl") - cp2.ExpectNotExitCode(0) - ts.IgnoreLogErrors() + cp2.ExpectExitCode(0) cp.SendCtrlC() cp.SendLine("exit")