mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:21:58 +00:00
Delete script files before replacing during update (#984)
* Delete script files before replacing during update Signed-off-by: Tim Etchells <tetchel@gmail.com> * Use IOUtil.DelteFile() Co-authored-by: Tingluo Huang <tingluohuang@github.com>
This commit is contained in:
committed by
TingluoHuang
parent
69d4341e6c
commit
6e04a2f31c
@@ -357,8 +357,13 @@ namespace GitHub.Runner.Listener
|
||||
Trace.Info($"Copy any remaining .sh/.cmd files into runner root.");
|
||||
foreach (FileInfo file in new DirectoryInfo(latestRunnerDirectory).GetFiles() ?? new FileInfo[0])
|
||||
{
|
||||
// Copy and replace the file.
|
||||
file.CopyTo(Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Root), file.Name), true);
|
||||
string destination = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Root), file.Name);
|
||||
|
||||
// Removing the file instead of just trying to overwrite it works around permissions issues on linux.
|
||||
// https://github.com/actions/runner/issues/981
|
||||
Trace.Info($"Copy {file.FullName} to {destination}");
|
||||
IOUtil.DeleteFile(destination);
|
||||
file.CopyTo(destination, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user