Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
* Fix a bug in `defn` where the `attr-map?` and function metdata were merged into a seq instead of a map, causing `macroexpand` to fail in some cases (#1186)
* Fix a bug where `basilisp.process/exec` threw an exception when inheriting the stdout stream from the current process (#1190)

## [v0.3.5]
### Changed
Expand Down
4 changes: 3 additions & 1 deletion src/basilisp/process.lpy
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@
(let [process (apply start opts+args)
retcode (.wait process)]
(if (zero? retcode)
(slurp (.-stdout process))
(if-let [out (.-stdout process)]
(slurp out)
Comment on lines +279 to +280
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just works differently than in Java. Python doesn't attach any stdout to the process object if you inherit the current process stdout, so we just have to check and return an empty string in that case.

"")
(throw
(subprocess/CalledProcessError retcode
(.-args process)
Expand Down
1 change: 1 addition & 0 deletions tests/basilisp/test_process.lpy
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@

(deftest exec-test
(is (= "" (process/exec sys/executable "-c" "pass")))
(is (= "" (process/exec {:out :inherit} sys/executable "-c" "print(\"hi\")")))
(is (= "" (process/exec sys/executable "-c" "import sys; print(\"hi\", file=sys.stderr)")))
(is (= "hi\n" (process/exec sys/executable "-c" "print(\"hi\")")))
(is (thrown? subprocess/CalledProcessError
Expand Down
Loading