Browse Source

Do not hang forever if not on a TTY

master
Matheus Fernandes 8 years ago
parent
commit
5682d00bf3
No known key found for this signature in database GPG Key ID: DD07CA4EA7B65C4F
  1. 47
      bin/now-deploy.js

47
bin/now-deploy.js

@ -607,29 +607,36 @@ async function sync(token) {
const plan = await planPromise; const plan = await planPromise;
if (plan.id === 'oss') { if (plan.id === 'oss') {
info( if (isTTY) {
`You are on the OSS plan. Your code will be made ${chalk.bold('public')}.` info(
); `You are on the OSS plan. Your code will be made ${chalk.bold('public')}.`
);
let proceed; let proceed;
try { try {
const label = 'Are you sure you want to proceed with the deployment?'; const label = 'Are you sure you want to proceed with the deployment?';
proceed = await promptBool(label, { trailing: eraseLines(2) }); proceed = await promptBool(label, { trailing: eraseLines(2) });
} catch (err) { } catch (err) {
if (err.message === 'USER_ABORT') { if (err.message === 'USER_ABORT') {
proceed = false; proceed = false;
} else { } else {
throw err; throw err;
}
} }
}
if (!proceed) { if (!proceed) {
const stopSpinner = wait('Canceling deployment'); const stopSpinner = wait('Canceling deployment');
now.remove(now.id, { hard: true }); now.remove(now.id, { hard: true });
stopSpinner(); stopSpinner();
info('Deployment aborted. No files were synced.'); info('Deployment aborted. No files were synced.');
info(`You can upgrade by running ${cmd('now upgrade')}.`); info(`You can upgrade by running ${cmd('now upgrade')}.`);
return exit(); return exit();
}
} else if (!wantsPublic) {
let msg = '\nYou are on the OSS plan. Your code will be made public.';
msg += ' If you agree with that, please run again with --public.';
console.log(msg);
return exit(1);
} }
} }

Loading…
Cancel
Save