20 lines
383 B
TypeScript
20 lines
383 B
TypeScript
|
const repl_file = Bun.file("./.lrepl")
|
||
|
const repl_info = await repl_file.json()
|
||
|
const port = repl_info.port
|
||
|
|
||
|
const socket = await Bun.connect({
|
||
|
hostname: "localhost",
|
||
|
port,
|
||
|
socket: {
|
||
|
data: (_, data) => process.exit()
|
||
|
}
|
||
|
})
|
||
|
|
||
|
for await (const input of Bun.stdin.stream()) {
|
||
|
const chunk = Buffer.from(input).toString("utf-8")
|
||
|
socket.write(chunk)
|
||
|
socket.end()
|
||
|
process.exit()
|
||
|
}
|
||
|
|