forked from xonsh/xonsh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
procs: Add CommandPipeline.raw_out for retreival of the raw stdout bytes
- Loading branch information
1 parent
1ee8e38
commit d85ed4a
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
**Added:** | ||
|
||
* Added ``CommandPipeline.raw_out`` to get stdout as raw bytes. | ||
|
||
**Changed:** | ||
|
||
* <news item> | ||
|
||
**Deprecated:** | ||
|
||
* <news item> | ||
|
||
**Removed:** | ||
|
||
* <news item> | ||
|
||
**Fixed:** | ||
|
||
* <news item> | ||
|
||
**Security:** | ||
|
||
* <news item> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" | ||
Tests for subprocesses and CommandPipeline. | ||
""" | ||
|
||
import pytest | ||
from xonsh.procs.pipelines import CommandPipeline | ||
|
||
|
||
@pytest.mark.parametrize("cmdline, stdout, stderr", ( | ||
("!(echo hi)", b"hi\n", None), | ||
("![echo hi]", b"hi\n", None), | ||
("!(echo hi o>e)", b"", "hi\n"), | ||
("![echo hi o>e]", b"", "hi\n"), | ||
(r"!(echo 'hi\nho')", b"hi\nho\n", None), | ||
)) | ||
def test_captured(xonsh_execer, cmdline, stdout, stderr): | ||
pipeline: CommandPipeline = xonsh_execer.eval(cmdline) | ||
assert pipeline.raw_out == stdout | ||
assert pipeline.out == stdout.decode() | ||
assert pipeline.err == stderr |
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