Comments (31)
Hi evilebottnawi, thank you for your report.
So, how did you use readlineSync? GitLab CI runner, build script for something, testing your app, or in your app?
If you tried to make readlineSync run in some wrapped environment such as CI auto script that runs at background (i.e. without TTY), readlineSync should not work, because readlineSync is used to reading that interactivity.
from readline-sync.
@anseki maybe not throw Exception, simply display an error and when you try use function also display error. Exception breaks build :(
from readline-sync.
So, how did you use readlineSync?
from readline-sync.
@anseki i use gulp and require readline-sync in gulp file
from readline-sync.
I see.
Try to execute gulp
command directly with that gulpfile, then does it work fine?
from readline-sync.
@anseki yes all working fine outside docker container
from readline-sync.
TTY might have been not enabled.
Try to make docker run with -t
option.
And make gulp run in this session.
from readline-sync.
@anseki https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
no option for set -t
from readline-sync.
Not GitLab CI.
This is TTY test.
from readline-sync.
@anseki
i run ls -l /dev
output:
...
crw-rw-rw- 1 root root 5, 0 Jan 15 16:43 tty
...
tty exist in folder
from readline-sync.
@anseki full error from logs
stty: when specifying an output style, modes may not be set
/some_path/node_modules/readline-sync/lib/read.sh: 49: /some_path/node_modules/readline-sync/lib/read.sh: cannot create /dev/tty: No such device or address
stty: standard input: Inappropriate ioctl for device
/some_path/node_modules/readline-sync/lib/readline-sync.js:66
if (res.error) { throw res.error; }
^
Error: The platform doesn't support interactive reading
stty: when specifying an output style, modes may not be set
/some_path/node_modules/readline-sync/lib/read.sh: 49: /some_path/node_modules/readline-sync/lib/read.sh: cannot create /dev/tty: No such device or address
stty: standard input: Inappropriate ioctl for device
from readline-sync.
Not exist or not test.
TTY has to be enabled.
from readline-sync.
I don't know what you want to do, but if you don't need interactive reading, you can ignore the error by catching the thrown error.
try {
key = readlineSync.keyIn();
} catch (e) {}
from readline-sync.
@anseki with -t
work all fine
from readline-sync.
Good for you 😃
So, was the issue solved? will this issue be closed?
from readline-sync.
@anseki no :(. gitlab-ci run without flag -t
. But this is a problem not apply here.
from readline-sync.
You can enable TTY by -t
option and specify --name gitlab-ci-runner
to make it run within same session.
BTW, I don't know what you want to do... Why you need interactive reading in CI? These should be in conflict.
I think that you should catch the thrown error.
from readline-sync.
I think that this #26 (comment) might help you.
from readline-sync.
@anseki I searched through the documentation but could not find the option set up -t
from readline-sync.
I think that this #26 (comment) and this #26 (comment) might help you without -t
option.
from readline-sync.
@anseki no
from readline-sync.
I'm using readline-sync on windows (git-bash.exe).
`C:\Users\sikkache\AppData\Roaming\npm\node_modules\jira\node_modules\readline-sync\lib\readline-sync.js:250
if (res.error) { throw res.error; }
^
Error: The current environment doesn't support interactive reading from TTY.
at readlineExt (C:\Users\sikkache\AppData\Roaming\npm\node_modules\jira\node_modules\readline-sync\lib\readline-sync.js:212:19)
at tryExt (C:\Users\sikkache\AppData\Roaming\npm\node_modules\jira\node_modules\readline-sync\lib\readline-sync.js:249:15)
at C:\Users\sikkache\AppData\Roaming\npm\node_modules\jira\node_modules\readline-sync\lib\readline-sync.js:352:15
at _readlineSync (C:\Users\sikkache\AppData\Roaming\npm\node_modules\jira\node_modules\readline-sync\lib\readline-sync.js:422:5)
at getValidLine (C:\Users\sikkache\AppData\Roaming\npm\node_modules\jira\node_modules\readline-sync\lib\readline-sync.js:752:11)
at Object.exports.question (C:\Users\sikkache\AppData\Roaming\npm\node_modules\jira\node_modules\readline-sync\lib\readline-sync.js:834:10)
at Object. (C:\Users\sikkache\AppData\Roaming\npm\node_modules\jira\index.js:8:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
sikkache@DAP-CHA-POR0109 MINGW64 /d/Documents/Programmation/NodeJS/jira (master)
$ ls -l /dev
...
crw-rw-rw- 1 sikkache 1049089 5, 0 avr. 4 10:39 tty
`
Thank you for your help
from readline-sync.
Hi @SelimIkkache,
Could you show me your code?
And, which version of readlineSync, Windows, bash and Node.js?
Also, did the code work in CMD?
from readline-sync.
Versions :
[email protected]
Windows: 7
Git Bash: GNU bash, version 4.4.12(1)-release (x86_64-pc-msys)
Node js: v6.9.5
It works in CMD
The code
#!/usr/bin/env node
// Entry point for the program
var readlineSync = require('readline-sync');
var Basic = require('./helper/basic')
var jiraLPCArgs = new (require('./helper/cli-args'))()
// Get password for JIRA
jiraLPCArgs.auth.setDigest(jiraLPCArgs.user,
readlineSync.question('Enter your password ', {hideEchoBack: true}))
from readline-sync.
I closed my git bash and relaunch it, I have no more issues
from readline-sync.
By the way, this code works in CMD, but not in GitBash.
There is no output at all on gitbash.
Output on CMD
C:\Users\sikkache>jiralpc
Enter your password *********
STATUS: [object Object]
ERROR: null
CCU-3828 - [LPC][TEC] Nettoyer le code suite au remarque du linter : phase 1 - B
loquant
CCU-3808 - [LPC] [TEC] Créations de règles pour le linter - Majeur
_[...]_
Output on gitbash
$ jiralpc
And it is frozen for ever
from readline-sync.
I see.
It seems that your environment (MinGW) does not support interactive reading from TTY. That is, the error message is correct.
Since readlineSync is library to read and write via TTY, of course it can't work with no TTY.
REPL also may not work in your environment. try this:
node
console.log('foo');
from readline-sync.
You're right, it doesn't work ever.
So Howcan I make it work ?
from readline-sync.
That is solved simply, by using it in an environment that TTY is available.
I think that you probably use a decent terminal such as Cmder instead of CMD that has many problems, as everyone knows.
Or, if you really want to use MinGW, #33 might help you. But I don't recommend it.
from readline-sync.
Thank you, you can solve the issue according to me.
from readline-sync.
😄
from readline-sync.
Related Issues (20)
- question does not print the expected character HOT 4
- looking for help in building the console application with syntax highlight HOT 9
- Non-ASCII Character Issues HOT 9
- `hideEchoBack: true` disables backspace. HOT 3
- Is there any way to take multi-line input? HOT 6
- Error on Windows when input is redirected HOT 9
- Chinese character problem HOT 12
- Allow movements like in bash terminal (Left, Right) HOT 9
- Readline-sync not working in VSCode HOT 9
- Read a markdown file line by line in sync HOT 23
- Multiple select HOT 5
- Can't distinguish between EOD and a blank input line HOT 9
- a qusetion about encoding HOT 4
- Other code cannot be run HOT 3
- "Assertion `(argc) == (5)' failed." error on calling functions HOT 8
- readline-sync does not print special/unicode chars, bu tusing normal console.log() works fine HOT 2
- node.js may crash on windows 10 when console in/out is redirected HOT 3
- keypress event not firing after keyInSelect HOT 2
- Adding a default answer option to keyInYN* HOT 5
- Cannot redirect standard input HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from readline-sync.