Merge: Windows: fix bootstrap
authorJean Privat <jean@pryen.org>
Wed, 20 Jun 2018 18:59:15 +0000 (14:59 -0400)
committerJean Privat <jean@pryen.org>
Wed, 20 Jun 2018 18:59:15 +0000 (14:59 -0400)
It looks like the use of the method `is_tty` in Nit tools triggered the FFI compilation of the `posix` module which fails on Windows. This module imports some headers that are unavailable in the msys2 environment, as used by our test servers.

Pull-Request: #2711
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

1  2 
lib/core/file.nit

diff --combined lib/core/file.nit
@@@ -306,6 -306,9 +306,9 @@@ redef class In
        private fun fd_to_stream(mode: CString): NativeFile `{
                return fdopen((int)self, mode);
        `}
+       # Does the file descriptor `self` refer to a terminal?
+       fun isatty: Bool `{ return isatty(self); `}
  end
  
  # Constant for read-only file streams
@@@ -1362,7 -1365,7 +1365,7 @@@ redef class FlatStrin
                var p = last_byte
                var c = its[p]
                var st = _first_byte
 -              while p >= st and c != '.'.ascii do
 +              while p >= st and c != u'.' do
                        p -= 1
                        c = its[p]
                end
                var l = s.last_byte
                var its = s._items
                var min = s._first_byte
 -              var sl = '/'.ascii
 +              var sl = u'/'
                while l > min and its[l] == sl do l -= 1
                if l == min then return "/"
                var ns = l
@@@ -1523,7 -1526,7 +1526,7 @@@ private extern class NativeFile `{ FILE
                return (long)res;
        `}
  
 -      fun write_byte(value: Byte): Int `{
 +      fun write_byte(value: Int): Int `{
                unsigned char b = (unsigned char)value;
                return fwrite(&b, 1, 1, self);
        `}