Skip to content

Instantly share code, notes, and snippets.

@DanielFGray
Created February 4, 2019 23:59
Show Gist options
  • Save DanielFGray/9b88d1b787a64366dd6eb39aa59f6ebc to your computer and use it in GitHub Desktop.
Save DanielFGray/9b88d1b787a64366dd6eb39aa59f6ebc to your computer and use it in GitHub Desktop.
tput
const tput = require('./tput')()
tput.write('smcup')
tput.write('cup 0 0')
process.stdout.write('foo')
process.on('exit', () => {
tput.write('rmcup')
process.exit()
})
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