1833883 Members
1795 Online
110063 Solutions
New Discussion

scrap doubt

 
varap
Occasional Advisor

scrap doubt

Hi ,

I have an expect script which is working fine , when run from command line . But the same expect file is not working correctly
when it is invoked from scrap file .

In the expect script i am executing "ls" command and I want my program to wait for the timeout to happen ( I am not putting any
matching patterns under expect command except timeout ) . You can run the expect script from the command line and see its behaviour ( correct ) .

Here I am attaching the expect script and scrap file for your reference.

************
expect file : tt.exp
***************************************
#! /usr/local/bin/expect

proc spawn_proc {args} {
global temp_id
puts "\t$args"
eval spawn $args
return $spawn_id
}

set timeout 100
spawn_proc ls

expect {
timeout { send_user "\nTimed out\n" }
}

# Wait for timeout to occur

puts "program completed successfully "


*********************************************
scrap file : tmp.zmf
***********************************************

#! /usr/local/bin/scrap -f

5 minute timeout

STDOUT_DEBUG=1
STDERR_DEBUG=1

JAGae29081 {
{
name is JAGae29081_1
keywords JAGae29081_1

args /tmp/tt.exp
run
}
}


But When I run my expect script through scrap file ( " ./tmp.zmf -C ) I am getting two errors .

1. The program is not waiting till the timeout happens ( 100 secs in this case). It is just coming out immediately after executing "ls" command.

2. In the error log file ( 2_JAGae29081_1 file created under build dir when tmp.zmf is run using "-C" option ) it is printing the following error.

error writing "stdout": bad file number
while executing
"puts "program completed successfully ""
(file "/opt/ids/test/agent/idsagent/tt.exp" line 19)^M


Any pointers in fixing this problem are highly appreciated.

TIA,
Vara.