anchor.diff:    }
     if (echoMode != null && stdin.hasTerminal) {
       final previousEchoMode = stdin.echoMode;
  -    stdin.echoMode = echoMode;
  -    return _stdinLines.first.whenComplete(() {
  +    try {
  +      stdin.echoMode = echoMode;
  +      final result = await _stdinLines.next;
  +      stdout.write('\n');
  +      return result;
  +    } finally {
         stdin.echoMode = previousEchoMode;
  -    });
  +    }
     } else {
  -    return _stdinLines.first;
  +    return await _stdinLines.next;
     }
   }
   
  
positive.code: })();
  
  /// A line-by-line stream of standard input.
  final Stream<String> _stdinLines =
      ByteStream(stdin).toStringStream().transform(const LineSplitter());
  
  /// Displays a message and reads a yes/no confirmation from the user.
  ///
  
negative.code: }
  
  /// Writes [prompt] and reads a line from stdin.
  Future<String> stdinPrompt(String prompt, {bool? echoMode}) async {
    if (runningFromTest) {
      log.message(prompt);
    } else {
  