| 163 | } |
| 164 | |
| 165 | public sendData(str: string | Buffer) { |
| 166 | if (this.source) { |
| 167 | try { |
| 168 | if (((typeof str === 'string') || (str instanceof String)) && |
| 169 | (this.options.inputmode === TerminalInputMode.COOKED)) { |
| 170 | str = Buffer.from(str as string, this.options.iencoding); |
| 171 | } |
| 172 | this.source.write(str); |
| 173 | } |
| 174 | catch (e) { |
| 175 | console.error(`RTTTerminal:sendData failed ${e}`); |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | private sanitizeEncodings(obj: RTTConsoleDecoderOpts) { |
| 181 | obj.encoding = getBinaryEncoding(obj.encoding); |