From 95696559b778463d1edddf57327d25a8ee28af8b Mon Sep 17 00:00:00 2001 From: div72 <60045611+div72@users.noreply.github.com> Date: Sat, 4 Jul 2020 02:48:01 +0300 Subject: [PATCH] os: fix early termination when saving binary (#5646) --- vlib/net/http/download.v | 4 +++- vlib/os/os.v | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/vlib/net/http/download.v b/vlib/net/http/download.v index cfc8455879..3adcd69c91 100644 --- a/vlib/net/http/download.v +++ b/vlib/net/http/download.v @@ -6,7 +6,9 @@ module http import os pub fn download_file(url, out string) bool { - println('download file url=$url out=$out') + $if debug_http? { + println('download file url=$url out=$out') + } s := get(url) or { return false } diff --git a/vlib/os/os.v b/vlib/os/os.v index 98751a7f7e..f3857d4cfb 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -39,7 +39,7 @@ pub fn (mut f File) write(s string) { } } */ - C.fputs(s.str, f.cfile) + C.fwrite(s.str, s.len, 1, f.cfile) } pub fn (mut f File) writeln(s string) {