[Swift-commit] r6172 - trunk/libexec

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Tue Jan 29 10:25:37 CST 2013


Author: davidk
Date: 2013-01-29 10:25:37 -0600 (Tue, 29 Jan 2013)
New Revision: 6172

Modified:
   trunk/libexec/_swiftwrap
Log:
Fix for _swiftwrap on mac, and also better handle situations where /bin/time isn't found


Modified: trunk/libexec/_swiftwrap
===================================================================
--- trunk/libexec/_swiftwrap	2013-01-29 08:03:42 UTC (rev 6171)
+++ trunk/libexec/_swiftwrap	2013-01-29 16:25:37 UTC (rev 6172)
@@ -479,19 +479,27 @@
 
     TIMEARGS=(-o swiftapp.resources -f APP_RESOURCES=real_secs:%e,kernel_secs:%S,user_secs:%U,percent_cpu:%P,max_rss:%M,avg_rss:%t,avg_tot_vm:%K,avg_priv_data:%D,avg_priv_stack:%p,avg_shared_text:%X,page_size:%Z,major_pgfaults:%F,minor_pgfaults:%R,swaps:%W,invol_context_switches:%c,vol_waits:%w,fs_reads:%I,fs_writes:%O,sock_recv:%r,sock_send:%s,signals:%k,exit_status:%x)
 
-    if [ -x /usr/bin/time ]; then
+    if [[ "$OSTYPE" == *darwin* ]]; then
+        TIMECMD=
+        TIMEARGS=
+    elif [ -x /usr/bin/time ]; then
         TIMECMD="/usr/bin/time"
     elif [ -x $HOME/swift.time ]; then
         TIMECMD="$HOME/swift.time"
     else
         TIMECMD=""
-		TIMEARGS=""
+	TIMEARGS=""
     fi
 	if [ "$STDIN" == "" ]; then
 		if [ "$SWIFT_GEN_SCRIPTS" != "" ]; then
 			genScripts
 		fi
-        "$TIMECMD" "${TIMEARGS[@]}" "$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR"
+                
+                if [ -n "$TIMECMD" ] && [ -n "$TIMEARGS" ]; then
+                   "$TIMECMD" "${TIMEARGS[@]}" "$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR"
+                else
+                   "$EXEC" "${CMDARGS[@]}" 1>>"$STDOUT" 2>>"$STDERR"
+                fi
 	else
 		if [ "$SWIFT_GEN_SCRIPTS" != "" ]; then
 			genScripts




More information about the Swift-commit mailing list