Commits

Miki Tebeka committed a3bc0a0

defering

Comments (0)

Files changed (1)

 package main
 
 import (
-	"exec"
 	"fmt"
-	"os"
-	"bufio"
 )
 
+func c() (i int) {
+	defer func() {
+		i++
+	}()
+	return 1
+}
+
 func main() {
-	cmd, _ := exec.Run("/bin/ls", []string{"ls", "/tmp"}, os.Environ(), "",
-		exec.DevNull, exec.Pipe, exec.MergeWithStdout)
-
-	reader := bufio.NewReader(cmd.Stdout)
-	for {
-		line, err := reader.ReadString('\n')
-		if err != nil {
-			break
-		}
-		fmt.Println(line)
-	}
-	cmd.Close()
+	fmt.Println(c())
 }