Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for stdin #63

Closed
laptrinhvui000 opened this issue May 8, 2021 · 4 comments
Closed

support for stdin #63

laptrinhvui000 opened this issue May 8, 2021 · 4 comments

Comments

@laptrinhvui000
Copy link

I try to find buildin function for stdin like cin or scanf but I can't. Not include in std or global yet
For example, in d8 shell, google use readline() to input when typing in console
Screen Shot 2021-05-08 at 9 18 25 AM

@nykula
Copy link

nykula commented May 8, 2021

std.out.puts("name?");
var name = std.in.getline();

@laptrinhvui000
Copy link
Author

laptrinhvui000 commented May 9, 2021

std.out.puts("name?");
var name = std.in.getline();
It's halt after std.in.getline(); on mac os (brew install quickjs). I can't type anything.

Screen Shot 2021-05-09 at 11 47 09 AM

@nykula
Copy link

nykula commented May 9, 2021

Try it in a script file, outside the REPL. It's a blocking function so I think it'll interfere with the REPL main loop which uses the stdin too.

@laptrinhvui000
Copy link
Author

Thanks! the script work with: qjs script.js .

GerHobbelt pushed a commit to GerHobbelt/quickjs that referenced this issue Oct 17, 2023
* replace master -> main

* yarn doc

* rebuild
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants