Skip to content

Commit

Permalink
挪到 bee.windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Feb 19, 2024
1 parent eab7e6d commit b6e452c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 6 additions & 6 deletions script/encoder/ansi.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
local platform = require 'bee.platform'
local unicode
local windows

if platform.OS == 'Windows' then
unicode = require 'bee.unicode'
windows = require 'bee.windows'
end

local m = {}

function m.toutf8(text)
if not unicode then
if not windows then
return text
end
return unicode.a2u(text)
return windows.a2u(text)
end

function m.fromutf8(text)
if not unicode then
if not windows then
return text
end
return unicode.u2a(text)
return windows.u2a(text)
end

return m
11 changes: 6 additions & 5 deletions script/proto/proto.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
local subprocess = require 'bee.subprocess'
local socket = require 'bee.socket'
local util = require 'utility'
local await = require 'await'
local pub = require 'pub'
local jsonrpc = require 'jsonrpc'
local define = require 'proto.define'
local json = require 'json'
local inspect = require 'inspect'
local thread = require 'bee.thread'
local platform = require 'bee.platform'
local fs = require 'bee.filesystem'
local net = require 'service.net'
local timer = require 'timer'
Expand Down Expand Up @@ -234,8 +232,11 @@ end
function m.listen(mode, socketPort)
m.mode = mode
if mode == 'stdio' then
subprocess.filemode(io.stdin, 'b')
subprocess.filemode(io.stdout, 'b')
if platform.OS == 'Windows' then
local windows = require 'bee.windows'
windows.filemode(io.stdin, 'b')
windows.filemode(io.stdout, 'b')
end
io.stdin:setvbuf 'no'
io.stdout:setvbuf 'no'
pub.task('loadProtoByStdio')
Expand Down

0 comments on commit b6e452c

Please sign in to comment.