Skip to content

Commit

Permalink
[process_run] v0.14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Jan 15, 2024
1 parent 8a61474 commit 1fdda52
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
4 changes: 4 additions & 0 deletions packages/process_run/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.14.1

* add `runSync` and `runExecutableArgumentsSync` to global space and to `Shell`

## 0.14.0+1

* No longer replace `\` by `\\` before splitting arguments
Expand Down
23 changes: 10 additions & 13 deletions packages/process_run/doc/shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,20 @@ await run('echo "Hello world"');
await run('echo ${shellArgument('Hello world')}');
```

### Changing directory
## Running the script in synchronous mode

You can pushd/popd a directory
The synchronous mode is useful for testing. It is not recommended for production use as
it is a synchronous call and will block until the child process terminates.

```dart
shell = shell.pushd('example');
await shell.run('''
# Listing directory in the example folder
dir
''');
shell = shell.popd();
```dart
var shell = Shell();
// This is a synchronous call and will block until the child process terminates.
var results = shell.runSync('echo "Hello world"');
var result = results.first;
print('output: "${result.outText.trim()}" exitCode: ${result.exitCode}');
// should display: output: "Hello world" exitCode: 0
```


### Handling errors

By default, `run` will throw an error if the `exitCode` is not 0. You can prevent that
Expand Down
7 changes: 7 additions & 0 deletions packages/process_run/example/demo_sync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import 'dart:io';
import 'package:process_run/process_run.dart';

void main() {
var shell = Shell();
// This is a synchronous call and will block until the child process terminates.
var results = shell.runSync('echo "Hello world"');
var result = results.first;
print('output: "${result.outText.trim()}" exitCode: ${result.exitCode}');
// should display: output: "Hello world" exitCode: 0

// Run the command
runExecutableArgumentsSync('echo', ['hello world']);

Expand Down
2 changes: 1 addition & 1 deletion packages/process_run/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: process_run
version: 0.14.0+1
version: 0.14.1
description: Process run helpers for Linux/Win/Mac and which like feature for finding executables.
homepage: https://github.com/tekartik/process_run.dart/blob/master/packages/process_run

Expand Down

0 comments on commit 1fdda52

Please sign in to comment.