Skip to content

Commit 6b4b00b

Browse files
committed
handle ESC in proxy confirmation without crashing
1 parent 9fba73e commit 6b4b00b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

packages/cli/src/commands/add.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,9 @@ export default class AddCommand extends Command {
112112
),
113113
);
114114
if (impl) {
115-
const useImplementation = await prompt.confirm(
116-
`Proxy contract detected. Use current implementation contract ABI at ${impl}?`,
117-
true,
118-
);
115+
const useImplementation = await prompt
116+
.confirm(`Proxy contract detected. Use implementation contract ABI at ${impl}?`, true)
117+
.catch(() => false);
119118

120119
if (useImplementation) {
121120
implAddress = impl;

packages/cli/src/commands/init.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,12 @@ async function processInitForm(
635635
);
636636
initDebugger.extend('processInitForm')("proxyImplementation: '%s'", impl);
637637
if (impl) {
638-
const useImplementation = await prompt.confirm(
639-
`Proxy contract detected. Use current implementation contract ABI at ${impl}?`,
640-
true,
641-
);
638+
const useImplementation = await prompt
639+
.confirm(
640+
`Proxy contract detected. Use implementation contract ABI at ${impl}?`,
641+
true,
642+
)
643+
.catch(() => false);
642644

643645
if (useImplementation) {
644646
implAddress = impl;

0 commit comments

Comments
 (0)