1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Update test helper procedure 'get_pwd' to handle the ComSpec environment variable being absent.

FossilOrigin-Name: fe1979552f43e0526f16481457e01981f29707401f77079f9854a8d91b35b5a4
This commit is contained in:
mistachkin
2021-01-18 19:27:56 +00:00
parent abc6b67aff
commit f3ebea8114
4 changed files with 24 additions and 13 deletions

View File

@ -21,7 +21,7 @@ source $testdir/tester.tcl
# Only run these tests if memory debugging is turned on.
#
ifcapable !crashtest||!memorymanage {
puts "Skipping crash5 tests: not compiled with -DSQLITE_MEMDEBUG..."
puts "Skipping crash5 tests: not compiled with -DSQLITE_ENABLE_MEMORY_MANAGEMENT..."
finish_test
return
}
@ -49,8 +49,14 @@ for {set ii 0} {$ii < 10} {incr ii} {
[list set iFail $jj] {
proc get_pwd {} {
if {$::tcl_platform(platform) eq "windows"} {
if {[info exists ::env(ComSpec)]} {
set comSpec $::env(ComSpec)
} else {
# NOTE: Hard-code the typical default value.
set comSpec {C:\Windows\system32\cmd.exe}
}
return [string map [list \\ /] \
[string trim [exec -- $::env(ComSpec) /c echo %CD%]]]
[string trim [exec -- $comSpec /c echo %CD%]]]
} else {
return [pwd]
}

View File

@ -174,8 +174,14 @@ proc get_pwd {} {
# case of the result to what Tcl considers canonical, which would
# defeat the purpose of this procedure.
#
if {[info exists ::env(ComSpec)]} {
set comSpec $::env(ComSpec)
} else {
# NOTE: Hard-code the typical default value.
set comSpec {C:\Windows\system32\cmd.exe}
}
return [string map [list \\ /] \
[string trim [exec -- $::env(ComSpec) /c echo %CD%]]]
[string trim [exec -- $comSpec /c echo %CD%]]]
} else {
return [pwd]
}