Skip to content

Commit

Permalink
Only copy to clipboard for TTY
Browse files Browse the repository at this point in the history
  • Loading branch information
leo committed Feb 10, 2017
1 parent 4081884 commit a650cf7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/listening.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = async (server, current, inUse) => {
const ipAddress = ip.address()
const url = `http://${ipAddress}:${details.port}`

const isTTY = process.stdout.isTTY

process.on('SIGINT', () => {
server.close()
process.exit(0)
Expand All @@ -44,10 +46,12 @@ module.exports = async (server, current, inUse) => {
message += `• ${chalk.bold('Local: ')} ${localURL}\n`
message += `• ${chalk.bold('On Your Network: ')} ${url}\n\n`

const copied = await copyToClipboard(url)
if (isTTY) {
const copied = await copyToClipboard(url)

if (copied) {
message += `${chalk.grey('Copied local address to clipboard!')}`
if (copied) {
message += `${chalk.grey('Copied local address to clipboard!')}`
}
}

console.log(boxen(message, {
Expand Down

0 comments on commit a650cf7

Please sign in to comment.