fix #2640, truncate files when redirecting output to them
Merge branch 'master' of github.com:JuliaLang/julia