Compare commits

...

1 Commits

Author SHA1 Message Date
Matisse Hack
3b6fb51f7f Self update fix when running under impersonation (#1124)
* Always use run.cmd to restart runner on update

* Pass args to updated run.cmd
2021-07-22 11:25:47 +02:00
2 changed files with 11 additions and 4 deletions

View File

@@ -24,10 +24,10 @@ if /i "%~1" equ "localRun" (
rem ********************************************************************************
"%~dp0bin\Runner.Listener.exe" run %*
rem Return code 4 means the run once runner received an update message.
rem Return codes 3 and 4 mean the runner received an update message.
rem Sleep 5 seconds to wait for the update process finish and run the runner again.
if ERRORLEVEL 4 (
if ERRORLEVEL 3 (
timeout /t 5 /nobreak > NUL
"%~dp0bin\Runner.Listener.exe" run %*
"%~dp0run.cmd" %*
)
)

View File

@@ -396,7 +396,14 @@ namespace GitHub.Runner.Listener
autoUpdateInProgress = true;
var runnerUpdateMessage = JsonUtility.FromString<AgentRefreshMessage>(message.Body);
var selfUpdater = HostContext.GetService<ISelfUpdater>();
selfUpdateTask = selfUpdater.SelfUpdate(runnerUpdateMessage, jobDispatcher, !runOnce && HostContext.StartupType != StartupType.Service, HostContext.RunnerShutdownToken);
#if OS_WINDOWS
var restartInteractiveRunner = false;
#else
var restartInteractiveRunner = !runOnce;
#endif
selfUpdateTask = selfUpdater.SelfUpdate(runnerUpdateMessage, jobDispatcher, restartInteractiveRunner, HostContext.RunnerShutdownToken);
Trace.Info("Refresh message received, kick-off selfupdate background process.");
}
else