diff --git a/lib/listening.js b/lib/listening.js index 71d984b1..416c49f7 100644 --- a/lib/listening.js +++ b/lib/listening.js @@ -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) @@ -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, {