Blob Blame History Raw
#!/usr/bin/expect -f

set dir [lindex $argv 0]

spawn abrt-cli report $dir

set timeout 10
set workflow_no 3

# timeout handler
proc itstime {args} {
    puts "!! expect timeout !!"
        exit 1
}

while {1} {
    expect {

        eof {break}

        timeout { itstime }

        -regexp {[[:space:]]+([[:digit:]]+)[[:space:]]+Report to CentOS Bug Tracker} {
            set workflow_no $expect_out(1,string)
        }

        "Ok to upload core dump? (It may contain sensitive data)." {
            send "N\n"
        }
        "This problem was already reported to CentOS Bug Tracker" {
            send "y\n"
        }
        -re "Downloading.*Continue?.*" {
            send "N\n"
        }
        "CentOS Bug Tracker Password" {
            send "\n"
        }
        "CentOS Bug Tracker User name" {
            send "\n"
        }
        "CentOS Bug Tracker CentOS Bug Tracker project" {
            send "\n"
        }
        "Select a workflow to run" {
            send "$workflow_no\n"
        }
    }
}