Skip to content

Commit

Permalink
Update update-notifier.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SaadBazaz authored Dec 6, 2024
1 parent cfa174a commit 6cb0832
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions update-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class UpdateNotifier {
this.#options = options;
options.pkg ??= {};
options.distTag ??= 'latest';
options.printFn ??= console.error;

// Reduce pkg to the essential keys. with fallback to deprecated options
// TODO: Remove deprecated options at some point far into the future
Expand Down Expand Up @@ -76,7 +77,7 @@ export default class UpdateNotifier {
+ chalk.cyan(format(' sudo chown -R $USER:$(id -gn $USER) %s ', xdgConfig));

process.on('exit', () => {
console.error(boxen(message, {textAlignment: 'center'}));
options.printFn(boxen(message, {textAlignment: 'center'}));
});
}
}
Expand Down Expand Up @@ -165,10 +166,10 @@ export default class UpdateNotifier {
);

if (options.defer === false) {
console.error(message);
options.printFn(message);
} else {
process.on('exit', () => {
console.error(message);
options.printFn(message);
});
}

Expand Down

0 comments on commit 6cb0832

Please sign in to comment.