melos
melos copied to clipboard
Handle prompts when no terminal is attached to stdio
Is there an existing issue for this?
- [X] I have searched the existing issues.
Version
2.6.0
Description
I'm getting an error hard do understand running both melos publish and melos publish --no-dry-run
the most relevant info are below, but you can also find the whole run here the repository is open source so you can find the files here
melos.yaml
name: yak_packages
packages:
- examples/**
- packages/**
scripts:
publish:
run: |
melos run lint:format && \
melos publish && \
melos publish --no-dry-run
description: publish packageson pub.dev
ignore:
- examples/**
# [...]
lint:format:
run: |
melos exec \
--concurrency 1 \
-- \
flutter format . \
--fix
description: Run `flutter format` for all packages.
# [...]
.github/workflows/pub-lish.yml
name: 'pub-lish'
on:
push:
branches:
- master
jobs:
pub-lish:
name: 'publish to pub.dev'
runs-on: ubuntu-latest
steps:
- name: 'checkout'
uses: actions/checkout@v3
- name: 'setup java'
uses: actions/setup-java@v3
with:
distribution: 'adopt-openj9'
java-version: '9'
- name: 'setup flutter'
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: 'update PATH'
run: |
echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH && \
echo "PUB_CACHE="$HOME/.pub-cache"" >> $GITHUB_ENV
- name: 'setup credentials'
run: |
mkdir $HOME/.pub-cache/ && \
touch $HOME/.pub-cache/credentials.json && \
cat <<EOF > $HOME/.pub-cache/credentials.json
{
"accessToken":"${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }}",
"refreshToken":"${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }}",
"tokenEndpoint":"https://accounts.google.com/o/oauth2/token",
"scopes":["https://www.googleapis.com/auth/userinfo.email","openid"],
"expiration":${{ secrets.PUB_DEV_PUBLISH_EXPIRATION }}
}
EOF
- name: 'activate melos'
run: |
dart pub global activate melos
- name: 'install dependencies'
run: |
melos bootstrap
- name: 'publishing'
run: |
melos run publish
logs
The following packages WILL be published to the registry:
Package Name Registry Local
example 0.0.1 1.0.0+1
yak_result 1.0.0+2 1.0.0+3
Unhandled exception:
StdinException: Error getting terminal echo mode, OS Error: Inappropriate ioctl for device, errno = 25
#0 Stdin.echoMode (dart:io-patch/stdio_patch.dart:72:7)
#1 get (package:prompts/prompts.dart:60:27)
#2 getBool (package:prompts/prompts.dart:176:16)
#3 promptBool (package:melos/src/common/utils.dart:164:18)
#4 _PublishMixin.publish (package:melos/src/commands/publish.dart:86:[30](https://github.com/iapicca/yak_packages/runs/7406122431?check_suite_focus=true#step:9:31))
<asynchronous suspension>
#5 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#6 MelosCommandRunner.runCommand (package:melos/src/command_runner.dart:80:5)
<asynchronous suspension>
#7 main (file:///home/runner/.pub-cache/hosted/pub.dartlang.org/melos-2.6.0/bin/melos.dart:43:5)
<asynchronous suspension>
The following packages will be validated only (dry run):
Package Name Registry Local
yak_result 1.0.0+2 1.0.0+3
example 0.0.1 1.0.0+1
Unhandled exception:
StdinException: Error getting terminal echo mode, OS Error: Inappropriate ioctl for device, errno = 25
#0 Stdin.echoMode (dart:io-patch/stdio_patch.dart:72:7)
#1 get (package:prompts/prompts.dart:60:27)
#2 getBool (package:prompts/prompts.dart:176:16)
#3 promptBool (package:melos/src/common/utils.dart:164:18)
#4 _PublishMixin.publish (package:melos/src/commands/publish.dart:86:30)
<asynchronous suspension>
#5 CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#6 MelosCommandRunner.runCommand (package:melos/src/command_runner.dart:80:5)
<asynchronous suspension>
#7 main (file:///home/runner/.pub-cache/hosted/pub.dartlang.org/melos-2.6.0/bin/melos.dart:43:5)
<asynchronous suspension>
Steps to reproduce
clone the repo and push anything to master triggering
run the .github/workflows/pub-lish.yml provided above
(it fails even in dry-run so you don't need secrets)
Expected behavior
at least an intelligible error
Screenshots
none
Additional context and comments
none
Thanks for the detailed report!
The problem is that we are not handling the cases where we prompt the user for input, but there is no terminal connected to stdin.
Most users invoke melos version and melos publish manually, but we should support running those commands in CI or programmatically.
thanks @blaugold I'll try it out :)