1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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

This commit is contained in:
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

View File

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