Skip to content

Commit 2bc4805

Browse files
committed
Disable hyperlinks when cleanup config is enabled
When the 'cleanup' config option is set to true, work directories are deleted after workflow completion. In this case, hyperlinks to those directories would be useless, so disable them. https://claude.ai/code/session_014AStcyMzd39iegXhfQL1yK Signed-off-by: Claude <noreply@anthropic.com>
1 parent eb08591 commit 2bc4805

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

modules/nextflow/src/main/groovy/nextflow/trace/AnsiLogObserver.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ class AnsiLogObserver implements TraceObserverV2 {
465465
final numbs = " ${(int)com} of ${(int)tot}".toString()
466466

467467
// Task hash, eg: [fa/71091a]
468-
// If workDir is available, make the hash a clickable hyperlink
469-
final hashDisplay = stats.workDir ? hyperlink(hh, stats.workDir) : hh
468+
// If workDir is available and cleanup is not enabled, make the hash a clickable hyperlink
469+
final hashDisplay = (stats.workDir && !session.config.cleanup) ? hyperlink(hh, stats.workDir) : hh
470470
term.a(Attribute.INTENSITY_FAINT).a('[').reset()
471471
term.fg(Color.BLUE).a(hashDisplay).reset()
472472
term.a(Attribute.INTENSITY_FAINT).a('] ').reset()

modules/nextflow/src/test/groovy/nextflow/trace/AnsiLogObserverTest.groovy

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package nextflow.trace
1818

19+
import nextflow.Session
1920
import spock.lang.Specification
2021
import spock.lang.Unroll
2122

@@ -124,7 +125,9 @@ class AnsiLogObserverTest extends Specification {
124125
def 'should render a process line with workDir hyperlink' () {
125126

126127
given:
128+
def session = Mock(Session) { getConfig() >> [cleanup: false] }
127129
def observer = new AnsiLogObserver()
130+
observer.@session = session
128131
def stats = new ProgressRecord(1, 'foo')
129132
stats.submitted = SUBMIT
130133
stats.succeeded = SUCCEEDED
@@ -154,4 +157,28 @@ class AnsiLogObserverTest extends Specification {
154157
null | null | 0 | 0 | '-' | null
155158
}
156159

160+
def 'should not render hyperlink when cleanup is enabled' () {
161+
162+
given:
163+
def session = Mock(Session) { getConfig() >> [cleanup: true] }
164+
def observer = new AnsiLogObserver()
165+
observer.@session = session
166+
def stats = new ProgressRecord(1, 'foo')
167+
stats.submitted = 1
168+
stats.hash = '4e/486876'
169+
stats.workDir = '/work/4e/486876abc'
170+
171+
when:
172+
observer.@labelWidth = stats.name.size()
173+
observer.@cols = 190
174+
def result = observer.line(stats).toString()
175+
176+
then:
177+
// Should NOT contain hyperlink escape sequences
178+
!result.contains('\033]8;;')
179+
!result.contains('\007')
180+
// But should still contain the hash
181+
result.replaceAll('\u001B\\[[\\d;]*[^\\d;]','').contains('4e/486876')
182+
}
183+
157184
}

0 commit comments

Comments
 (0)