You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
In which of these areas are you experiencing a problem?
Hydrogen custom storefront
Expected behavior
await keypress() doesn't exit the process.
Actual behavior
In some situations, calling await keypress() simply ends the process in cli-kit >=3.50.0
It used to work in 3.49.7
Verbose output
See below
Reproduction steps
We are experiencing this in Hydrogen CLI with the command npm create @shopify/[email protected]. Choose "Login with Shopify" and it will internally call keypress, then exit immediately
I've trimmed this down to a combination of renderTextPrompt (or any rendering that accepts a key) followed by keypress:
importCommandfrom'@shopify/cli-kit/node/base-command';import{keypress,renderTextPrompt}from'@shopify/cli-kit/node/ui';exportdefaultclassTestextendsCommand{asyncrun(): Promise<void>{console.log('1 start\n');awaitrenderTextPrompt({message: 'Enter anything',allowEmpty: true});console.log('2 keypress');awaitkeypress();console.log('3 end -- THIS SHOULD BE LOGGED');}}
I believe the reason is that, somehow, Node's event loop becomes empty while awaiting for the keypress and it just exits.
If we artificially add something to the event loop, it works again:
console.log('1 start\n');awaitrenderTextPrompt({message: 'Enter anything',allowEmpty: true});console.log('2 keypress');constdummyTimeout=setTimeout(()=>{},999999);awaitkeypress();clearTimeout(dummyTimeout);console.log('3 end -- THIS SHOULD BE LOGGED');
Operating System
Mac OS Sonoma 14.0
Shopify CLI version (check your project's package.json if you're not sure)
3.50.1
Shell
zsh
Node version (run node -v if you're not sure)
v18.2.0
What language and version are you using in your application?
No response
The text was updated successfully, but these errors were encountered:
Please confirm that you have:
In which of these areas are you experiencing a problem?
Hydrogen custom storefront
Expected behavior
await keypress()
doesn't exit the process.Actual behavior
In some situations, calling
await keypress()
simply ends the process in cli-kit >=3.50.0It used to work in 3.49.7
Verbose output
Reproduction steps
We are experiencing this in Hydrogen CLI with the command
npm create @shopify/[email protected]
. Choose "Login with Shopify" and it will internally callkeypress
, then exit immediatelyI've trimmed this down to a combination of
renderTextPrompt
(or any rendering that accepts a key) followed bykeypress
:I believe the reason is that, somehow, Node's event loop becomes empty while awaiting for the keypress and it just exits.
If we artificially add something to the event loop, it works again:
Operating System
Mac OS Sonoma 14.0
Shopify CLI version (check your project's
package.json
if you're not sure)3.50.1
Shell
zsh
Node version (run
node -v
if you're not sure)v18.2.0
What language and version are you using in your application?
No response
The text was updated successfully, but these errors were encountered: