File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -916,19 +916,23 @@ public Object getTarget() {
916916 protected void kill () {
917917 super .kill ();
918918 closeChannel ();
919- try {
920- log .close ();
921- } catch (IOException x ) {
922- LOGGER .log (Level .WARNING , "Failed to close agent log" , x );
923- }
924-
919+ closeLog ();
925920 try {
926921 Util .deleteRecursive (getLogDir ());
927922 } catch (IOException ex ) {
928923 logger .log (Level .WARNING , "Unable to delete agent logs" , ex );
929924 }
930925 }
931926
927+ @ Restricted (NoExternalUse .class )
928+ public void closeLog () {
929+ try {
930+ log .close ();
931+ } catch (IOException x ) {
932+ LOGGER .log (Level .WARNING , "Failed to close agent log" , x );
933+ }
934+ }
935+
932936 @ Override
933937 public RetentionStrategy getRetentionStrategy () {
934938 Slave n = getNode ();
Original file line number Diff line number Diff line change 176176import hudson .slaves .NodeProvisioner ;
177177import hudson .slaves .OfflineCause ;
178178import hudson .slaves .RetentionStrategy ;
179+ import hudson .slaves .SlaveComputer ;
179180import hudson .tasks .BuildWrapper ;
180181import hudson .tasks .Builder ;
181182import hudson .tasks .Publisher ;
@@ -3776,6 +3777,9 @@ private Set<Future<?>> _cleanUpDisconnectComputers(final List<Throwable> errors)
37763777 try {
37773778 c .interrupt ();
37783779 c .setNumExecutors (0 );
3780+ if (Main .isUnitTest && c instanceof SlaveComputer sc ) {
3781+ sc .closeLog (); // help TemporaryDirectoryAllocator.dispose esp. on Windows
3782+ }
37793783 pending .add (c .disconnect (null ));
37803784 } catch (OutOfMemoryError e ) {
37813785 // we should just propagate this, no point trying to log
You can’t perform that action at this time.
0 commit comments