Created
February 4, 2019 23:59
-
-
Save DanielFGray/9b88d1b787a64366dd6eb39aa59f6ebc to your computer and use it in GitHub Desktop.
tput
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
const tput = require('./tput')() | |
tput.write('smcup') | |
tput.write('cup 0 0') | |
process.stdout.write('foo') | |
process.on('exit', () => { | |
tput.write('rmcup') | |
process.exit() | |
}) |
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
const { spawn } = require('child_process') | |
module.exports = function tput() { | |
const instance = spawn('tput', ['-S'], { stdio: ['pipe', 'inherit', 'inherit'] }) | |
return { | |
write: line => instance.stdin.write(`${line}\n`), | |
end: () => instance.stdin.end(), | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment