mpab: better error handling in subports.tcl

git-svn-id: https://svn.macports.org/repository/macports/contrib/mpab@81236 d073be05-634f-4543-b044-5fe20cf6d1d6
This commit is contained in:
Joshua Root
2011-07-28 00:50:08 +00:00
parent a6990a031f
commit 36f3f5884e
+8 -4
View File
@@ -40,17 +40,21 @@ package require macports
if {[catch {mportinit "" "" ""} result]} {
ui_error "$errorInfo"
fatal "Failed to initialize ports sytem: $result"
ui_error "Failed to initialize ports sytem: $result"
exit 1
}
if {[llength $::argv] == 0} {
fatal "Usage: $argv0 <portname>"
puts stderr "Usage: $argv0 <portname>"
exit 1
}
set portname [lindex $::argv 0]
if {[catch {set one_result [mportlookup $portname]}]} {
fatal "lookup failed for port: $portname"
if {[catch {set one_result [mportlookup $portname]}] || [llength $one_result] < 2} {
# just pass it through, MPAB will complain about it later
puts $portname
exit 0
}
puts [lindex $one_result 0]
array set portinfo [lindex $one_result 1]