Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1404 search path of exec command under C:\Program Files

obsolete: 8.3
closed-works-for-me
nobody
5
2001-04-05
2000-12-01
Anonymous
No

#------------------------------------------------------------------------------
# File: exec_test.tcl
#------------------------------------------------------------------------------
# simple test proc to show the behaviour of exec and its search path on windows NT
#
# 1. Copy the script to some directory e.g. C:\My Documents
# add a program e.g. echo.exe
#
# 2: observe, that the function works as expected. All test cases are successful
#
# 3. copy the script and your program under c:\Program Files
#
# 4. see that the script fails in CASE1 and CASE2!!
#
###############################################################################

# define a program which is located in the same directory as this script
set prog echo

# show the console
console show
# make sure the search path is set
set env(PATH) "$env(PATH);[pwd]"

##-----------------------------------------------------------------------------
## Begin: test case find the program through search path
##-----------------------------------------------------------------------------
if {[catch {set out [exec $prog "CASE1: found the program"]} res]} {
puts "CASE1: ERROR: $res"
puts "ENV: $env(PATH)"

} else {
puts $out
}

if {[catch {set out [exec $prog.exe "CASE2: found the program"]} res]} {
puts "CASE2: ERROR: $res"
puts "ENV: $env(PATH)"
} else {
puts $out
}

if {[catch {set out [exec [pwd]/prog.exe "CASE3: found the program"]} res]} {
puts "CASE3: ERROR: $res"
} else {
puts $out
}

Discussion

    • labels: 104247 --> 104241
     
  • Jeffrey Hobbs
    Jeffrey Hobbs
    2001-03-28

    Logged In: YES
    user_id=72656

    I cannot repeat this in the simpler case with tclsh and an
    echo.bat that simply says:

    ---8<---8<---
    @echo off
    echo here we are %*
    ---8<---8<---

    Note the above program has some errors (like the calling of
    prog in case 3). There may have been other interactions
    which caused the failure (or a better example is needed).

     
  • Jeffrey Hobbs
    Jeffrey Hobbs
    2001-03-28

    • status: open --> closed
     
  • Don Porter
    Don Porter
    2001-03-28

    • status: closed --> closed-works-for-me
     
  • Don Porter
    Don Porter
    2001-04-05

    • labels: 104241 --> 27. Channel Types