Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 762940a08f02dd458684aa6c073d1128d1a1111d
Ticket: 30c5d37cfa0028c9ef83fa9efc490f4bc28b64ff
Expect eof occurring before end of output from spawned process
User & Date: tld on 2013-08-12 14:46:25
Changes

  1. icomment:
    Below I've pasted a Tcl script that reproduces the issue.  While it's not an expect script, it's still using the Expect package.  I'm not actually clear as to how to even try a similar test with no involvement of Expect at all, as this seems to be related to the EOF from a spawned external process.  Is that even doable in Tcl with anything other than spawn/expect?
    
    Anyway, here's a Tcl script version of the above test, which again, duplicated the issue using "tclsh test.tcl > out.txt":
    
    package require Expect
    set timeout 30
    
    proc exitspawnstat args {
       catch wait result
       set rtn [lindex $result 2]
       if { !$rtn } {
          set rtn [lindex $result 3]
       }
       exit $rtn
    }
    
    exp_log_user 1
    spawn -noecho cat ./in.txt
    expect {
    	eof {
    		exitspawnstat
    	}
    	timeout {
    		exp_log_user 1
    		exp_send_user "Timeout.\n"
    		exit 253
    	}
    	-nocase -re "password:" { 
    		exp_continue
    	}
    	"(yes/no)? " { 
    		exp_continue
    	}
    	-nocase -re "Enter passphrase" {
    		exp_continue
    	}
    	"testing-sudo-passwd:" {
    		exp_continue
    	}
    }
    
  2. login: "tld"
  3. mimetype: "text/plain"