Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Commit

Permalink
Make encoding parameter nullable (#65)
Browse files Browse the repository at this point in the history
This aligns the interface with the upstream `dart:io` API.

The `covariant` keyword is used for backward compatibility. It should be
removed in the next major release.

cc #64
  • Loading branch information
lambda-fairy authored Jul 26, 2021
1 parent 0c9aeac commit d6c245e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#### 4.2.2

* Mark `stderrEncoding` and `stdoutEncoding` parameters as nullable.

#### 4.2.1

* Added custom exception types `ProcessPackageException` and
Expand Down
8 changes: 4 additions & 4 deletions lib/src/interface/local_process_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class LocalProcessManager implements ProcessManager {
Map<String, String>? environment,
bool includeParentEnvironment = true,
bool runInShell = false,
Encoding stdoutEncoding = systemEncoding,
Encoding stderrEncoding = systemEncoding,
Encoding? stdoutEncoding = systemEncoding,
Encoding? stderrEncoding = systemEncoding,
}) {
try {
return Process.run(
Expand Down Expand Up @@ -98,8 +98,8 @@ class LocalProcessManager implements ProcessManager {
Map<String, String>? environment,
bool includeParentEnvironment = true,
bool runInShell = false,
Encoding stdoutEncoding = systemEncoding,
Encoding stderrEncoding = systemEncoding,
Encoding? stdoutEncoding = systemEncoding,
Encoding? stderrEncoding = systemEncoding,
}) {
try {
return Process.runSync(
Expand Down
10 changes: 6 additions & 4 deletions lib/src/interface/process_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ abstract class ProcessManager {
Map<String, String>? environment,
bool includeParentEnvironment = true,
bool runInShell = false,
Encoding stdoutEncoding = systemEncoding,
Encoding stderrEncoding = systemEncoding,
// TODO(#64): Remove the `covariant` keyword.
covariant Encoding? stdoutEncoding = systemEncoding,
covariant Encoding? stderrEncoding = systemEncoding,
});

/// Starts a process and runs it to completion. This is a synchronous
Expand All @@ -158,8 +159,9 @@ abstract class ProcessManager {
Map<String, String>? environment,
bool includeParentEnvironment = true,
bool runInShell = false,
Encoding stdoutEncoding = systemEncoding,
Encoding stderrEncoding = systemEncoding,
// TODO(#64): Remove the `covariant` keyword.
covariant Encoding? stdoutEncoding = systemEncoding,
covariant Encoding? stderrEncoding = systemEncoding,
});

/// Returns `true` if the [executable] exists and if it can be executed.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: process
version: 4.2.1
version: 4.2.2
description: A pluggable, mockable process invocation abstraction for Dart.
homepage: https://github.com/google/process.dart

Expand Down

0 comments on commit d6c245e

Please sign in to comment.