-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Console Interface Implementation
- Loading branch information
1 parent
67d7617
commit da573a9
Showing
4 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { execSync } from 'child_process' | ||
import { IConsoleInterface } from './iconsole-interface' | ||
|
||
export class ConsoleInterface implements IConsoleInterface { | ||
_output: Buffer | ||
|
||
setConsoleOutput(output: string): void { | ||
this._output = Buffer.from(output, 'utf8') | ||
} | ||
|
||
sendConsoleSync(command: string): Buffer { | ||
return this._output | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { execSync } from 'child_process' | ||
import { IConsoleInterface } from './iconsole-interface' | ||
|
||
export class ConsoleInterface implements IConsoleInterface { | ||
sendConsoleSync(command: string): Buffer { | ||
return execSync(command) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface IConsoleInterface { | ||
sendConsoleSync(command: string): Buffer | ||
} |