#!/usr/bin/expect
# Wrapper for scp. Workaround for not being able to use ssh keys due to cygwin
# not giving appropriate permissions.

set timeout -1

spawn scp [lindex $argv 1] [lrange $argv 2 10]

match_max 100000

expect *password:*

send "[lindex $argv 0]\n"

interact

catch wait reason

set exit_status [lindex $reason 3]

exit $exit_status
