Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"scripts": {
"build": "webpack --mode production && rm -rf dist/*.LICENSE.*",
"dev": "webpack watch --mode development"
"dev": "webpack watch --mode production"
},
"keywords": [
"xterm.js",
Expand Down
17 changes: 17 additions & 0 deletions src/Command.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default class Command {
static PIPE = Symbol("PIPE")
static STDOUT = Symbol("STDOUT")
static STDERR = Symbol("STDERR")

name
argv

constructor(name, argv, io = null) {
this.name = name
this.argv = argv

this.stdout = io?.stdout ?? Command.STDOUT
this.stderr = io?.stderr ?? Command.STDERR
this.append = io?.append ?? false
}
}
38 changes: 38 additions & 0 deletions src/Errors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export class CommandNotFoundError extends Error {
constructor(...params) {
super(...params)

// Maintains proper stack trace for where our error was thrown (non-standard)
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CommandNotFoundError)
}

this.name = "CommandNotFoundError"
}
}

export class KeyboardInterruptError extends Error {
constructor(...params) {
super(...params)

// Maintains proper stack trace for where our error was thrown (non-standard)
if (Error.captureStackTrace) {
Error.captureStackTrace(this, KeyboardInterruptError)
}

this.name = "KeyboardInterruptError"
}
}

export class CommandParserError extends Error {
constructor(...params) {
super(...params)

// Maintains proper stack trace for where our error was thrown (non-standard)
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CommandParserError)
}

this.name = "CommandParserError"
}
}
Loading