Last active
August 29, 2015 14:04
-
-
Save yifan-gu/fe088561df58cd830d69 to your computer and use it in GitHub Desktop.
test write full error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ go build testwritefull.go | |
$ sudo ./testwritefull | |
write err write /run/tmpfile: no space left on device |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"io" | |
) | |
func main() { | |
r, err := os.Open("/dev/zero") | |
f, err := os.Create("/run/tmpfile") | |
if err != nil { | |
fmt.Println("err", err) | |
return | |
} | |
for { | |
if _, err := io.Copy(f, r); err != nil { | |
fmt.Println("write err", err) | |
return | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment