forked from tools/josh
parent
aa8b641f53
commit
3305197c65
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "fwdekker.com",
|
||||
"version": "0.36.0",
|
||||
"version": "0.37.0",
|
||||
"description": "The source code of [my personal website](https://fwdekker.com/).",
|
||||
"author": "Felix W. Dekker",
|
||||
"browser": "dist/bundle.js",
|
||||
|
|
|
@ -105,5 +105,5 @@ body {
|
|||
|
||||
|
||||
.errorMessage {
|
||||
color: red;
|
||||
color: #FF3333;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,27 @@ export class Terminal {
|
|||
* The standard output stream.
|
||||
*/
|
||||
private readonly standardOutput = new Buffer();
|
||||
/**
|
||||
* The standard error stream, actually just a wrapper around the standard output stream.
|
||||
*/
|
||||
private readonly standardError = new class extends Buffer {
|
||||
private wrappedBuffer: Buffer;
|
||||
|
||||
|
||||
constructor(wrappedBuffer: Buffer) {
|
||||
super();
|
||||
|
||||
this.wrappedBuffer = wrappedBuffer;
|
||||
}
|
||||
|
||||
read(count: number | undefined = undefined): string {
|
||||
return this.wrappedBuffer.read(count);
|
||||
}
|
||||
|
||||
write(string: string) {
|
||||
this.wrappedBuffer.write(`<span class="errorMessage">${string}</span>`);
|
||||
}
|
||||
}(this.standardOutput);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -234,7 +255,7 @@ export class Terminal {
|
|||
this.outputText += `${this.prefixText}${this.isInputHidden ? "" : escapeHtml(input)}\n`;
|
||||
|
||||
this.standardInput.writeLine(input);
|
||||
this.shell.execute(new StreamSet(this.standardInput, this.standardOutput, this.standardOutput));
|
||||
this.shell.execute(new StreamSet(this.standardInput, this.standardOutput, this.standardError));
|
||||
|
||||
let buffer = "";
|
||||
while (this.standardOutput.has(1)) {
|
||||
|
|
|
@ -159,7 +159,6 @@ describe("commands", () => {
|
|||
it("executes the command if the previous command exited successfully", () => {
|
||||
environment.set("status", "" + ExitCode.OK);
|
||||
|
||||
// TODO (#129) Run `false` to check that the exit code changes
|
||||
expect(execute("and echo 'message'")).to.equal(ExitCode.OK);
|
||||
expect(readOut()).to.equal("message\n");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue