sdk icon indicating copy to clipboard operation
sdk copied to clipboard

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

Open alextekartik opened this issue 4 days ago • 1 comments

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: https://github.com/dart-lang/sdk/blob/e4fd90fc45a379570e965585e7f98b639264b616/pkg/dartdev/lib/src/progress.dart#L48-L74

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

alextekartik avatar Dec 07 '25 16:12 alextekartik