chore: fix chrome
This commit is contained in:
@@ -2,6 +2,8 @@ import type { Terminal } from '../terminal/Terminal'
|
||||
import type { EventBroadcaster } from '../utils/EventBroadcaster'
|
||||
|
||||
export abstract class Shell {
|
||||
readonly abstract Version: string
|
||||
readonly abstract Name: string
|
||||
broadcaster: EventBroadcaster
|
||||
terminal: Terminal
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Web-Uno Shell
|
||||
// the best name I could come up with lmao
|
||||
// the best name I could come up with lol
|
||||
|
||||
import { Clear } from '../program/Clear'
|
||||
import { Eval } from '../program/Eval'
|
||||
@@ -11,8 +11,12 @@ import { Terminal } from '../terminal/Terminal'
|
||||
import { EventBroadcaster } from '../utils/EventBroadcaster'
|
||||
import { SimpleStream } from '../utils/SimpleStream'
|
||||
import { Shell } from './Shell'
|
||||
import { Ls } from '../program/Ls'
|
||||
|
||||
export class Wush extends Shell {
|
||||
public readonly Version = "0.1.0"
|
||||
public readonly Name = "wush"
|
||||
|
||||
// buffer
|
||||
private buffer: string[] = []
|
||||
private bufferPos: number = 0
|
||||
@@ -51,6 +55,7 @@ export class Wush extends Shell {
|
||||
this.programs['loadprg'] = new Loadprg(this)
|
||||
this.programs['lsprg'] = new Lsprg(this)
|
||||
this.programs['info'] = new Info()
|
||||
this.programs['ls'] = new Ls()
|
||||
|
||||
this.stdout.on(data => this.WriteEscapedString(data))
|
||||
this.Prompt()
|
||||
@@ -78,12 +83,9 @@ export class Wush extends Shell {
|
||||
|
||||
WriteEscapedString(data: string) {
|
||||
let buf = data.split('')
|
||||
buf.forEach((char, i) => {
|
||||
if (this.ProcessControlCode(char)) {
|
||||
buf.splice(i, 1)
|
||||
} else {
|
||||
buf.forEach((char) => {
|
||||
if (!this.ProcessControlCode(char))
|
||||
this.terminal.Write(char)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -125,8 +127,9 @@ export class Wush extends Shell {
|
||||
.then(code => {
|
||||
this.execExitCode = code != -1 ? code : -2
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((e) => {
|
||||
this.WriteEscapedString("lol")
|
||||
this.WriteEscapedString(`\n${String(e)}\n`)
|
||||
})
|
||||
.finally(() => {
|
||||
// check if the exec actually exited with an exit code
|
||||
|
||||
Reference in New Issue
Block a user