-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#292) Now these can be spelled `os.call()` and `os.spawn()`, and we provide `Shellable[TupleN]` conversions to make it convenient to call without constructing a `Seq(...)` every time. So this: ```scala os.proc("ls", "doesnt-exist").call(cwd = wd, check = false, stderr = os.Pipe) ``` Becomes ```scala os.call(cmd = ("ls", "doesnt-exist"), cwd = wd, check = false, stderr = os.Pipe) ``` The original purpose of the `os.proc().call()` style was to avoid the verbosity of constructing a `Seq` each time, and by making it flexible enough to take tuples, this mitigates that issue without the annoying method chaining style. The new style still isn't actually shorter in terms of number of characters, but it is a lot cleaner in terms of "function call taking named/optional arguments" rather than "fluent call chain with first call taking varargs and second call taking named/optional parameters". It also aligns with the Python `subprocess.*` functions which OS-Lib in general is inspired by To support Scala 2, the `Shellable[TupleN]` conversions are defined using codegen. Scala 3 allows a nicer generic-tuple implementation, but we'll be supporting Scala 2 for the foreseeable future. The older `os.proc.*` APIs remain, both for backwards compatibility, as well as to support the `pipeTo` API used to construct process pipelines Duplicated some of the existing subprocess tests to exercise the new APIs. Did not duplicate all of them, as the new APIs are pretty dumb forwarders to the existing ones so we don't need to exercise every flag in detail. Updated the docs to point towards the new APIs, but with a mention that the older `os.proc().call()` style is still supported
- Loading branch information
Showing
5 changed files
with
298 additions
and
27 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
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
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
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
Oops, something went wrong.