diff src/sim.tp @ 24:8435bf0360f8

merge
author William Morgan <bill@mrgn.org>
date Sat, 14 Jul 2012 14:38:50 -0700
parents 75a005b210c5 be6d1cf7b7d7
children a224dc43877f
line wrap: on
line diff
--- a/src/sim.tp	Sat Jul 14 14:38:21 2012 -0700
+++ b/src/sim.tp	Sat Jul 14 14:38:50 2012 -0700
@@ -196,8 +196,7 @@
 		}
 	}
 	
-	readFile <- :path {
-		fd <- os open: path (os O_RDONLY)
+	readFd <- :fd {
 		if: fd < 0 { "" } else: {
 			cur <- ""
 			part <- ""
@@ -207,11 +206,17 @@
 			} do: {
 				cur <- cur . part
 			}
-			os close: fd
 			cur
 		}
 	}
 	
+	readFile <- :path {
+		fd <- os open: path (os O_RDONLY)
+		out <- readFd: fd
+		os close: fd
+		out
+	}
+	
 	getMove <- {
 		os read: 0 1
 	}