WalterBeiter
WalterBeiter

Reputation: 2354

expect: store output of a spawn command into variable

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.

Upvotes: 2

Views: 4052

Answers (1)

komar
komar

Reputation: 881

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)

Upvotes: 3

Related Questions