-
-
Save nex3/4aee4b681ffddf6480ea20dc75f8ad26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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