Revision
90074
Author
dports@macports.org
Date
2012-02-20 17:33:44 -0800 (Mon, 20 Feb 2012)

Log Message

`xcode-select -print-path` gives an error if no Xcode directory has
been selected; handle that case correctly.

Modified Paths

Diff

Modified: trunk/base/src/macports1.0/macports.tcl (90073 => 90074)


--- trunk/base/src/macports1.0/macports.tcl	2012-02-20 23:01:36 UTC (rev 90073)
+++ trunk/base/src/macports1.0/macports.tcl	2012-02-21 01:33:44 UTC (rev 90074)
@@ -429,11 +429,10 @@
     # Look for xcodeselect, and make sure it has a valid value
     if {![catch {findBinary xcode-select $macports::autoconf::xcode_select_path} xcodeselect]} {
 
-        # We have xcode-select: ask it where xcode is
-        set devdir [exec $xcodeselect -print-path 2> /dev/null]
-
-        # If the directory is valid, use it
-        if {[_is_valid_developer_dir $devdir]} {
+        # We have xcode-select: ask it where xcode is and check if it's valid.
+        # If no xcode is selected, xcode-select will fail, so catch that
+        if {![catch {exec $xcodeselect -print-path 2> /dev/null} devdir] &&
+            [_is_valid_developer_dir $devdir]} {
             set macports::developer_dir $devdir
             return
         }