Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Batect task failed with stdin is not a tty #945

Closed
mario-prabowo-xero opened this issue Jul 29, 2021 · 5 comments
Closed

Batect task failed with stdin is not a tty #945

mario-prabowo-xero opened this issue Jul 29, 2021 · 5 comments

Comments

@mario-prabowo-xero
Copy link

mario-prabowo-xero commented Jul 29, 2021

Issue: Batect task failed with error message stdin is not a tty.

  • This only happens when executing batect task from git pre-push script and not when running the task directly
  • The issue also doesn't happen when running the pre-push script manually and only happens when doing git push
  • The issue looks similar to issues found in Yarn/Husky. The workaround suggested in [4.0.0 | Git Bash | Windows 10] stdin is not a tty typicode/husky#627 works but it requires us to copy paste the command everywhere and we are not sure how it will affect other team members using Mac

Batect Version: from v 0.66.1 onwards (our team member reported that it was working fine in v 0.62 before migrating to v 0.66.1)
Operating System: Windows 10.

@charleskorn
Copy link
Collaborator

Hi @mario-prabowo-xero, thanks for the bug report. Just to confirm, are you using the most recent version of Batect?

If you are, are you able to share a sample project that demonstrates the issue?

@mario-prabowo-xero
Copy link
Author

Hi @charleskorn,

Thanks for your prompt response. We are using the latest version (0.72.0). We can't share the code as it's commercially sensitive, but I can try creating a sample project to reproduce the issue.

Thanks,

Mario

@mario-prabowo-xero
Copy link
Author

Hi @charleskorn,

I managed to reproduce the issue in my sample project. You can find it in https://github.com/mario-prabowo-xero/sample-batect.

Thanks,

Mario

@charleskorn
Copy link
Collaborator

Thanks for the reproduction repo @mario-prabowo-xero. I've been able to fix the issue and it will be included in the next release.

For the time being, you can make this change to line 86 of the batect wrapper script in your project to fix the problem:

-        if [[ "$(uname -o 2>&1)" == "Msys" ]] && hash winpty 2>/dev/null; then
+        if [[ "$(uname -o 2>&1)" == "Msys" ]] && hash winpty 2>/dev/null && [ -t /dev/stdin ]; then

@mario-prabowo-xero
Copy link
Author

Fantastic! Thanks for fixing it so quickly @charleskorn.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants