From ed34eab5e52ed77a6e91db7ca39580cb6aefbc8d Mon Sep 17 00:00:00 2001 From: Steven Schveighoffer Date: Sat, 25 Jul 2020 18:37:06 -0400 Subject: [PATCH] Fix Travis and AppVeyor builds. Fix version of meson project. --- .travis.yml | 2 +- meson.build | 2 +- src/std/io/driver/package.d | 2 +- src/std/io/file.d | 3 ++- src/std/io/net/socket.d | 1 - src/std/io/package.d | 7 ++++--- travis.sh | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f0858f..c4d6619 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ addons: - libssl-dev - pkg-config - zlib1g-dev - - ninja-build + # - ninja-build - python3 - python3-pip - python3-setuptools diff --git a/meson.build b/meson.build index d4aedd4..f12ae3a 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('io', 'd', default_options: ['optimization=3'], version: '0.2.5', license: 'BSL-1.0' ) +project('io', 'd', default_options: ['optimization=3'], version: '0.3.0', license: 'BSL-1.0' ) common_project_arguments = ['-release'] #, '--d-debug' add_project_arguments(common_project_arguments, language: 'd') diff --git a/src/std/io/driver/package.d b/src/std/io/driver/package.d index a9eaa16..1af5d80 100644 --- a/src/std/io/driver/package.d +++ b/src/std/io/driver/package.d @@ -274,7 +274,7 @@ version(Windows) STD_OUTPUT_HANDLE, STD_ERROR_HANDLE, ]; - return GetStdHandle(handles[fd]); + return () @trusted { return GetStdHandle(handles[fd]); }(); } } else version(Posix) diff --git a/src/std/io/file.d b/src/std/io/file.d index cc49c73..5d38801 100644 --- a/src/std/io/file.d +++ b/src/std/io/file.d @@ -408,6 +408,7 @@ private: } auto f = File("temp.txt", mode!"w"); + scope(exit) remove("temp.txt"); f = use(f.move); f = File("temp.txt", Mode.read); ubyte[4] buf; @@ -417,7 +418,7 @@ private: f.read(a[], b[]); assert(a[] == [4, 5]); assert(b[] == [6, 7]); - remove("temp.txt"); + //remove("temp.txt"); } version (unittest) private void remove(in char[] path) @trusted @nogc diff --git a/src/std/io/net/socket.d b/src/std/io/net/socket.d index f431ea5..387ec79 100644 --- a/src/std/io/net/socket.d +++ b/src/std/io/net/socket.d @@ -560,7 +560,6 @@ struct Socket auto s = this.s; auto cod = this.closeOnDestroy; this.s = Driver.SOCKET.INVALID; - this.s = Driver.SOCKET.INVALID; return Socket(s, cod); } diff --git a/src/std/io/package.d b/src/std/io/package.d index 25ef9d2..ffb9e7c 100644 --- a/src/std/io/package.d +++ b/src/std/io/package.d @@ -205,16 +205,17 @@ IOObject!IO ioObject(IO)(IO io) /// takes and interface static ubyte[] consume(scope Input input, return ubyte[] buf) @safe { + return buf[0 .. input.read(buf)]; } ubyte[4] ping = ['p', 'i', 'n', 'g']; - File("temp.txt", mode!"w").write(ping[]); + File("UT_1.txt", mode!"w").write(ping[]); scope (exit) - remove("temp.txt"); + remove("UT_1.txt"); - auto file = ioObject(File("temp.txt")); + auto file = ioObject(File("UT_1.txt")); ubyte[4] buf; assert(consume(file, buf[]) == ping[]); diff --git a/travis.sh b/travis.sh index 047b43f..2be224c 100755 --- a/travis.sh +++ b/travis.sh @@ -11,7 +11,7 @@ fi case "${BUILD_TOOL}" in meson) pip3 install --user --upgrade pip - pip install --user --upgrade meson + pip install --user --upgrade meson ninja meson builddir -Drun_test=true ninja -C builddir test ;;