Skip to content

Commit

Permalink
[doc] Add example for Piping to STDIN migration
Browse files Browse the repository at this point in the history
To give a concrete example for users to easily follow.
  • Loading branch information
honnix committed Jun 5, 2023
1 parent cdde901 commit 39dd2ec
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions MIGRATION.md
Expand Up @@ -80,6 +80,28 @@ Previously, if the first argument of a sh command was an instance of `RunningCom
it was automatically fed into the process's STDIN. This is no longer the case and you
must explicitly use `_in=`.

```python
from sh import wc,ls

print(wc(ls("/home/<user>", "-l"), "-l"))
```

Becomes:

```python
from sh import wc,ls

print(wc("-l", _in=ls("/home/<user>", "-l")))
```

Or:

```python
from sh import wc,ls

print(wc("-l", _in=ls("/home/<user>", "-l", _return_cmd=True)))
```

### Workaround

None
Expand Down

0 comments on commit 39dd2ec

Please sign in to comment.