stdin.readLineSync() is returning just a null when run within a docker symbol

replace: Answer is to run it with -it flag.


Take a easy program the usage of readlinesync()

import ‘dart:io’;

// report to turn docker factor

void primary(Listing<String> arguments) async {
stdout.write(“Input your identify, anon: “);

String? identify = stdin.readLineSync();
if( identify != null) {
print(“Hi $identify”);
} else {
print(“nShould no longer print this if readlineSync works.”);

Create a easy Dockerfile, as an example [this one](

Create the picture the usage of `docker construct -t hi .`

Then run is like

PS > dart run .binhelloworld.dart
Input your identify, anon: vishal
Hi vishal

PS > docker run hi
Input your identify, anon:
Will have to no longer print this if readlineSync works.

PS >

The adaptation is that within docker symbol, the readlineSync serve as does not go back the rest ( or best returns a null; does not learn any enter from keyboard).

What is the drawback right here?

View Reddit through vishalxlView Supply

You may also like...

WP2Social Auto Publish Powered By :