Skip to content

[dartdev] progress in "non-console" mode should add a newline #62189

@alextekartik

Description

@alextekartik

Following on issue #61996

Tested on dart 3.10 and linux. Simply add sqlite3 : ^3.0.0 that has build books steps.

Assuming the following bin/main.dart:

void main(List<String> arguments) {
  print('Hello');
}

Running the following script:

import 'dart:io';

import 'package:path/path.dart';

Future<void> main(List<String> args) async {
  var result = await Process.run(Platform.executable, [
    'run',
    join('bin', 'main.dart'),
  ]);
  stdout.write(result.stdout);
}

currently displayed to stdout:

Running build hooks...Running build hooks...Hello

This breaks many parsing tool as the output of the program itself does not even start on a new line.

While there should be a way to disable it in the future soon. Could the ouput simply be:

Running build hooks...
Hello

or with the time elapsed

Running build hooks...0.9
Hello

Currently in progress.dart:

_Progress(this._message) {
_stopwatch.start();
// The animation is only shown when it would be meaningful to a human.
// That means we're writing a visible message to a TTY at normal log levels
// with non-JSON output.
if (!_terminalOutputForStdout) {
// Not animating, so just log the start and wait until the task is
// completed.
stdout.write('$_message...');
return;
}
_timer = Timer.periodic(const Duration(milliseconds: 100), (_) {
_update();
});
stdout.write('$_message... ');
}
/// Stops the progress indicator.
void _stop() {
if (!_terminalOutputForStdout) {
// Not animating, so just log the start and wait until the task is
// completed.
stdout.write('$_message...');
return;

We have twice this call:

 if (!_terminalOutputForStdout) {
      // Not animating, so just log the start and wait until the task is
      // completed.
      stdout.write('$_message...');
      return;
    }

Since the comment does not make sens in _stop(), maybe its behavior is not what was intended and it should simply add a new line.

Or maybe it should not display anything at all when _terminalOutputForStdout is false

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions