1/* eslint-disable unicorn/no-process-exit */ 2'use strict'; 3let updateNotifier = require('.'); 4 5const options = JSON.parse(process.argv[2]); 6 7updateNotifier = new updateNotifier.UpdateNotifier(options); 8 9updateNotifier.checkNpm().then(update => { 10 // Only update the last update check time on success 11 updateNotifier.config.set('lastUpdateCheck', Date.now()); 12 13 if (update.type && update.type !== 'latest') { 14 updateNotifier.config.set('update', update); 15 } 16 17 // Call process exit explicitly to terminate the child process 18 // Otherwise the child process will run forever, according to the Node.js docs 19 process.exit(); 20}).catch(() => { 21 process.exit(1); 22}); 23