commit | 7266e0cc58d369bd7c5ac542c19878f48dff97da | [log] [tgz] |
---|---|---|
author | dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | Tue Jan 31 23:30:34 2023 -0800 |
committer | GitHub <noreply@github.com> | Tue Jan 31 23:30:34 2023 -0800 |
tree | 4f5a30bd499ea2f8b755e024bd10740824237510 | |
parent | 0467e967926820a0732a605b59e35818e5cfbeaf [diff] |
Bump dart-lang/setup-dart from 1.3 to 1.4 (#99) Bumps [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart) from 1.3 to 1.4. - [Release notes](https://github.com/dart-lang/setup-dart/releases) - [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md) - [Commits](https://github.com/dart-lang/setup-dart/compare/6a218f2413a3e78e9087f638a238f6b40893203d...a57a6c04cf7d4840e88432aad6281d1e125f0d46) --- updated-dependencies: - dependency-name: dart-lang/setup-dart dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Contains utilities for the Dart VM's dart:io
.
io.dart
isExecutable
Returns whether a provided file path is considered executable on the host operating system.
ExitCode
An enum
-like class that contains known exit codes.
ProcessManager
A higher-level service for spawning and communicating with processes.
spawn
to create a process with std[in|out|err] forwarded by defaultFuture<void> main() async { final manager = ProcessManager(); // Print `dart` tool version to stdout. print('** Running `dart --version`'); var spawn = await manager.spawn('dart', ['--version']); await spawn.exitCode; // Check formatting and print the result to stdout. print('** Running `dart format --output=none .`'); spawn = await manager.spawn('dart', ['format', '--output=none', '.']); await spawn.exitCode; // Check if a package is ready for publishing. // Upon hitting a blocking stdin state, you may directly // output to the processes's stdin via your own, similar to how a bash or // shell script would spawn a process. print('** Running pub publish'); spawn = await manager.spawn('dart', ['pub', 'publish', '--dry-run']); await spawn.exitCode; // Closes stdin for the entire program. await sharedStdIn.terminate(); }
sharedStdIn
A safer version of the default stdin
stream from dart:io
that allows a subscriber to cancel their subscription, and then allows a new subscriber to start listening. This differs from the default behavior where only a single listener is ever allowed in the application lifecycle:
test('should allow multiple subscribers', () async { final logs = <String>[]; final asUtf8 = sharedStdIn.transform(UTF8.decoder); // Wait for input for the user. logs.add(await asUtf8.first); // Wait for more input for the user. logs.add(await asUtf8.first); expect(logs, ['Hello World', 'Goodbye World']); });
For testing, an instance of SharedStdIn
may be created directly.
ansi.dart
import 'dart:io' as io; import 'package:io/ansi.dart'; void main() { // To use one style, call the `wrap` method on one of the provided top-level // values. io.stderr.writeln(red.wrap("Bad error!")); // To use multiple styles, call `wrapWith`. print(wrapWith('** Important **', [red, styleBold, styleUnderlined])); // The wrap functions will simply return the provided value unchanged if // `ansiOutputEnabled` is false. // // You can override the value `ansiOutputEnabled` by wrapping code in // `overrideAnsiOutput`. overrideAnsiOutput(false, () { assert('Normal text' == green.wrap('Normal text')); }); }
For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.