Skip to content

Instantly share code, notes, and snippets.

@nex3

nex3/repro.dart Secret

Created January 31, 2023 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nex3/4aee4b681ffddf6480ea20dc75f8ad26 to your computer and use it in GitHub Desktop.
Save nex3/4aee4b681ffddf6480ea20dc75f8ad26 to your computer and use it in GitHub Desktop.
import 'dart:async';
import 'dart:io';
Future<void> main() async {
File('script.dart').writeAsStringSync('''
import 'dart:io';
void main() {
stderr.writeln("*" * ((1 << 16) + 1));
}
''');
var process = await Process.start(
Platform.executable, [...Platform.executableArguments, 'script.dart']);
var controller = StreamController<List<int>>();
process.stderr.pipe(controller.sink);
print("exit code: ${await process.exitCode}");
print(
await controller.stream.fold<int>(0, (sum, chunk) => sum + chunk.length));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment