Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(toolkit): fix broken confirmation prompt #2333

Merged
merged 2 commits into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/aws-cdk/bin/cdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'source-map-support/register';

import colors = require('colors/safe');
import fs = require('fs-extra');
import util = require('util');
import yargs = require('yargs');

import { bootstrapEnvironment, destroyStack, SDK } from '../lib';
Expand All @@ -25,7 +24,6 @@ import { VERSION } from '../lib/version';

// tslint:disable-next-line:no-var-requires
const promptly = require('promptly');
const confirm = util.promisify(promptly.confirm);

// tslint:disable:no-shadowed-variable max-line-length
async function parseCommandLineArguments() {
Expand Down Expand Up @@ -359,7 +357,7 @@ async function initCommandLine() {

if (!force) {
// tslint:disable-next-line:max-line-length
const confirmed = await confirm(`Are you sure you want to delete: ${colors.blue(stacks.map(s => s.name).join(', '))} (y/n)?`);
const confirmed = await promptly.confirm(`Are you sure you want to delete: ${colors.blue(stacks.map(s => s.name).join(', '))} (y/n)?`);
if (!confirmed) {
return;
}
Expand Down
7 changes: 3 additions & 4 deletions packages/aws-cdk/lib/cdk-toolkit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import colors = require('colors/safe');
import fs = require('fs-extra');
import { format, promisify } from 'util';
import { format } from 'util';
import { AppStacks, ExtendedStackSelection } from "./api/cxapp/stacks";
import { IDeploymentTarget } from './api/deployment-target';
import { printSecurityDiff, printStackDiff, RequireApproval } from './diff';
Expand All @@ -9,7 +9,6 @@ import { deserializeStructure } from './serialize';

// tslint:disable-next-line:no-var-requires
const promptly = require('promptly');
const confirm = promisify(promptly.confirm);

export interface CdkToolkitProps {
/**
Expand Down Expand Up @@ -98,7 +97,7 @@ export class CdkToolkit {
'but terminal (TTY) is not attached so we are unable to get a confirmation from the user');
}

const confirmed = await confirm(`Do you wish to deploy these changes (y/n)?`);
const confirmed = await promptly.confirm(`Do you wish to deploy these changes (y/n)?`);
if (!confirmed) { throw new Error('Aborted by user'); }
}
}
Expand Down Expand Up @@ -230,4 +229,4 @@ export interface DeployOptions {
* Reuse the assets with the given asset IDs
*/
reuseAssets?: string[];
}
}