Skip to content

Commit 4112c84

Browse files
authored
fix(toolkit): fix broken confirmation prompt (#2333)
We recently upgraded to a 'promptly' version whose methods are already async, so no need to util.promisify it anymore. In fact, the promise would never be resolved.
1 parent cab71b6 commit 4112c84

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

packages/aws-cdk/bin/cdk.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'source-map-support/register';
33

44
import colors = require('colors/safe');
55
import fs = require('fs-extra');
6-
import util = require('util');
76
import yargs = require('yargs');
87

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

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

3028
// tslint:disable:no-shadowed-variable max-line-length
3129
async function parseCommandLineArguments() {
@@ -359,7 +357,7 @@ async function initCommandLine() {
359357
360358
if (!force) {
361359
// tslint:disable-next-line:max-line-length
362-
const confirmed = await confirm(`Are you sure you want to delete: ${colors.blue(stacks.map(s => s.name).join(', '))} (y/n)?`);
360+
const confirmed = await promptly.confirm(`Are you sure you want to delete: ${colors.blue(stacks.map(s => s.name).join(', '))} (y/n)?`);
363361
if (!confirmed) {
364362
return;
365363
}

packages/aws-cdk/lib/cdk-toolkit.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import colors = require('colors/safe');
22
import fs = require('fs-extra');
3-
import { format, promisify } from 'util';
3+
import { format } from 'util';
44
import { AppStacks, ExtendedStackSelection } from "./api/cxapp/stacks";
55
import { IDeploymentTarget } from './api/deployment-target';
66
import { printSecurityDiff, printStackDiff, RequireApproval } from './diff';
@@ -9,7 +9,6 @@ import { deserializeStructure } from './serialize';
99

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

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

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

0 commit comments

Comments
 (0)