expect: store output of a spawn command into varia

2019-08-22 08:53发布

Inside my "expect" script:

set $REPOS "/path/to/repo/"
set $REV 73
set LOG [spawn svnlook log -r $REV $REPOS]

What this will store in the variable "LOG": 16345 (memory location).

What it should store in the variable "LOG": "some message of the svn commit log".

It seems like the is a problem with executing a bash command and then storing that output into an expect variable.

Have you got any ideas? I am new to expect and tcl.

1条回答
手持菜刀,她持情操
2楼-- · 2019-08-22 09:12

You did't need spawn there. Try:

set LOG [exec svnlook log -r $REV $REPOS]

If you really want to use spawn:

spawn vnlook log -r $REV $REPOS
expect
set LOG $expect_out(buffer)
查看更多
登录 后发表回答