打卡25: expect interact for tow process
2014-10-23 17:10
148 查看
inject_wise: ----------------it call connect_wise :
set CW "connect_wise -c $COOLXDIR -pn 2 -f $RCSCELL"
spawn -open [open "| $CW" "w+"]
sleep 1
exp_send "$CMD\r"-------------------------------after start connect_wise ,send info to connect_wise ,connect_wise use interact to receive
sleep 3
connect_wise :
set outpipe_name $COOLXDIR/.${filePrefix}${coolwin}_$pipe_num.inpipe
set inpipe_name $COOLXDIR/.${filePrefix}${coolwin}_$pipe_num.outpipe
interact {
-input $user_spawn_id
eof {
#puts stdout "Hit eof of input"
exit
}
"" {
puts stdout "User requested exit"
exit
} -output $outpipe
-input $inpipe eof {
puts stderr "EOF from attached TTY"
exit
} -output $user_spawn_id
}
user_spawn_id---> outpipe
inpipe-->user_spawn_id
function:
input message in one ap term ,it will not only show in ap term ,but also in wise window,
two windows show the same together and at the same time
interact: wait for other process ,exp_send
user_spawn_id standard input and standard output
The -input flag identifies a spawn id from which input should be read. The -output flag identifies a spawn id to which output should be written
-input and -output can use multiple process
read from input pipe , write to output pipe
pile is special file ,input one line ,then read one line at the same time then next sentence
spawn for write and pipe file :
Expectsnormally uses spawn to invoke a program. It can look at the programsoutput and input data into the program.
Expectcan also use spawn to open a file but treat it as if it is a spawned program. That would be spawn –open [open <file> <mode>]. The<mode> indicates if expect will be reading from the file or writing toit.
Insteadof just opening a file, expect can also open a pipeline to or from a givenprogram. That would be spawn –open [open “| <program>”<mode>]. In this situation, the interface between expect and the programis only one-way. Either expect is inputting data
into program (if themode was “w” or “w+”) or expect is reading from the program (mode is “r”).
-------------------------
interact {
-input $user_spawn_id -output $spawn_id
-input $spawn_id -output $user_spawn_id
}
set CW "connect_wise -c $COOLXDIR -pn 2 -f $RCSCELL"
spawn -open [open "| $CW" "w+"]
sleep 1
exp_send "$CMD\r"-------------------------------after start connect_wise ,send info to connect_wise ,connect_wise use interact to receive
sleep 3
connect_wise :
set outpipe_name $COOLXDIR/.${filePrefix}${coolwin}_$pipe_num.inpipe
set inpipe_name $COOLXDIR/.${filePrefix}${coolwin}_$pipe_num.outpipe
interact {
-input $user_spawn_id
eof {
#puts stdout "Hit eof of input"
exit
}
"" {
puts stdout "User requested exit"
exit
} -output $outpipe
-input $inpipe eof {
puts stderr "EOF from attached TTY"
exit
} -output $user_spawn_id
}
user_spawn_id---> outpipe
inpipe-->user_spawn_id
function:
input message in one ap term ,it will not only show in ap term ,but also in wise window,
two windows show the same together and at the same time
interact: wait for other process ,exp_send
user_spawn_id standard input and standard output
The -input flag identifies a spawn id from which input should be read. The -output flag identifies a spawn id to which output should be written
-input and -output can use multiple process
read from input pipe , write to output pipe
pile is special file ,input one line ,then read one line at the same time then next sentence
spawn for write and pipe file :
Expectsnormally uses spawn to invoke a program. It can look at the programsoutput and input data into the program.
Expectcan also use spawn to open a file but treat it as if it is a spawned program. That would be spawn –open [open <file> <mode>]. The<mode> indicates if expect will be reading from the file or writing toit.
Insteadof just opening a file, expect can also open a pipeline to or from a givenprogram. That would be spawn –open [open “| <program>”<mode>]. In this situation, the interface between expect and the programis only one-way. Either expect is inputting data
into program (if themode was “w” or “w+”) or expect is reading from the program (mode is “r”).
-------------------------
interact {
-input $user_spawn_id -output $spawn_id
-input $spawn_id -output $user_spawn_id
}
相关文章推荐
- 关于一类external allocation too large for this process的处理
- 1002. A+B for Polynomials (25)
- Centos 7不能上网,Job for iptables.service failed because the control process exited with error code.
- PAT甲级 1002 A+B for Polynomials (25)
- Project Process for Small Organization
- while/for 嵌套expect 批量免密码传文件
- PAT甲级1002. A + B for Polynomials(25)
- SAS command process for expander
- 1002. A+B for Polynomials (25)
- 1002. A+B for Polynomials (25)
- 1002. A+B for Polynomials (25)
- Generic Host Process for Win32 Services
- 1047. Student List for Course (25)
- 真机调试出现Could not launch "FeedMeWorms" failed to get the task for process 3118
- Error:Unable to start the daemon process: could not reserve enough space for object hea
- RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
- AS导入aar包报错Error:Execution failed for task ':app:processDebugManifest'.
- android studio导入项目出错:Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger
- 1002. A+B for Polynomials (25)
- A1039. Course List for Student (25)