From b7dc0a2c906875ce017697cb9958e5df3cb7ab8d Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Tue, 29 Mar 2016 14:13:25 -0700 Subject: [PATCH] ignore update checking if no tty --- lib/check-update.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/check-update.js b/lib/check-update.js index 9d5eec3..ecdba9b 100644 --- a/lib/check-update.js +++ b/lib/check-update.js @@ -3,12 +3,24 @@ import pkg from '../../package'; // relative to `build/` :\ import fetch from 'node-fetch'; import chalk from 'chalk'; +const isTTY = process.stdout.isTTY; + +// if we're not in a tty the update checker +// will always return a resolved promise +const resolvedPromise = new Promise((resolve, reject) => resolve()); + /** * Configures auto updates. * Sets up a `exit` listener to report them. */ export default function checkUpdate (opts = {}) { + if (!isTTY) { + // don't attempt to check for updates + // if the user is piping or redirecting + return resolvedPromise; + } + let updateData; const update = check(opts).then((data) => {