616215df1b
fixes #29083 Change-Id: I5f4d7ac2a5df9600fd3ad12abc2dd6068d9980af Reviewed-on: https://dart-review.googlesource.com/23145 Reviewed-by: Ryan Macnak <rmacnak@google.com>
27 lines
679 B
Dart
27 lines
679 B
Dart
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import "dart:io";
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
void fiddleWithEchoMode() {
|
|
final bool echoMode = stdin.echoMode;
|
|
stdin.echoMode = false;
|
|
stdin.echoMode = true;
|
|
stdin.echoMode = echoMode;
|
|
}
|
|
|
|
void main() {
|
|
Expect.isNotNull(stdin.hasTerminal);
|
|
Expect.isTrue(stdin.hasTerminal is bool);
|
|
if (stdin.hasTerminal) {
|
|
fiddleWithEchoMode();
|
|
} else {
|
|
Expect.throws(() {
|
|
fiddleWithEchoMode();
|
|
}, (e) => e is StdinException);
|
|
}
|
|
}
|