refactor(core): consolidate pty service (#30537)

This commit is contained in:
Shoubhit Dash 2026-06-03 15:17:46 +05:30 committed by GitHub
commit 932fb6c9ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 504 additions and 576 deletions

View file

@ -0,0 +1,26 @@
import * as pty from "@lydell/node-pty"
import type { Opts, Proc } from "./pty"
export type { Disp, Exit, Opts, Proc } from "./pty"
export function spawn(file: string, args: string[], opts: Opts): Proc {
const proc = pty.spawn(file, args, opts)
return {
pid: proc.pid,
onData(listener) {
return proc.onData(listener)
},
onExit(listener) {
return proc.onExit(listener)
},
write(data) {
proc.write(data)
},
resize(cols, rows) {
proc.resize(cols, rows)
},
kill(signal) {
proc.kill(signal)
},
}
}