term: fix a leak in _test.v files in the default test runner without -autofree

pull/12496/head^2
Delyan Angelov 2021-11-17 20:39:08 +02:00
parent dbf469e000
commit 2733319879
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 10 additions and 0 deletions

View File

@ -173,8 +173,12 @@ fn imax(x int, y int) int {
return if x > y { x } else { y }
}
[manualfree]
fn supports_escape_sequences(fd int) bool {
vcolors_override := os.getenv('VCOLORS')
defer {
unsafe { vcolors_override.free() }
}
if vcolors_override == 'always' {
return true
}
@ -182,11 +186,17 @@ fn supports_escape_sequences(fd int) bool {
return false
}
env_term := os.getenv('TERM')
defer {
unsafe { env_term.free() }
}
if env_term == 'dumb' {
return false
}
$if windows {
env_conemu := os.getenv('ConEmuANSI')
defer {
unsafe { env_conemu.free() }
}
if env_conemu == 'ON' {
return true
}