Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
e7dc6b2
Update zio, zio-streams, zio-test, ... to 1.0.11 (#161)
scala-steward Sep 19, 2021
dcc0076
Update sbt-mdoc to 2.2.23 (#162)
scala-steward Sep 19, 2021
e9af2d3
Update scala3-library to 3.0.2 (#165)
scala-steward Sep 19, 2021
1a28e27
Update sbt-scoverage to 1.9.0 (#170)
scala-steward Sep 19, 2021
e7abc6f
Update scala-library to 2.12.15 (#169)
scala-steward Sep 19, 2021
6d7eb2a
Update sbt-bloop to 1.4.9 (#168)
scala-steward Sep 19, 2021
45a2f45
Upgrade to scalafmt 3.0.4 (#173)
reibitto Sep 19, 2021
3a3d5bd
Update zio, zio-streams, zio-test, ... to 1.0.12 (#175)
scala-steward Sep 25, 2021
a60e154
Update Node.js to v14.18.0 (#179)
renovate[bot] Sep 28, 2021
76990dc
Update Node.js to v14.18.1 (#183)
renovate[bot] Oct 12, 2021
dea9614
Update actions/checkout action to v2.3.5 (#184)
renovate[bot] Oct 15, 2021
b4668b2
Update Node.js to v16 (#190)
renovate[bot] Oct 26, 2021
84a5c7b
Update Node.js to v16.13.0 (#191)
renovate[bot] Oct 26, 2021
5bbbe9d
Update actions/checkout action to v2.4.0 (#194)
renovate[bot] Nov 2, 2021
11db16f
Update sbt-mdoc to 2.2.24 (#186)
scala-steward Nov 22, 2021
cca2394
Update scalafmt-core to 3.0.8 (#192)
scala-steward Nov 22, 2021
a74684f
Update scala-library to 2.13.7 (#193)
scala-steward Nov 22, 2021
88354f6
Update scala-collection-compat to 2.6.0 (#197)
scala-steward Nov 22, 2021
c4f2fd3
Update sbt-scalafmt to 2.4.4 (#198)
scala-steward Nov 22, 2021
f492fe4
Update sbt-bloop to 1.4.11 (#195)
scala-steward Nov 22, 2021
529675a
Update sbt-scoverage to 1.9.2 (#196)
scala-steward Nov 22, 2021
46f3a99
Update Node.js to v16.13.1 (#202)
renovate[bot] Dec 1, 2021
3cd1363
Update sbt to 1.5.6 (#205)
scala-steward Dec 10, 2021
92122d3
Update sbt-unidoc to 0.5.0 (#189)
scala-steward Dec 15, 2021
092ea47
Update scalafmt-core to 3.2.1 (#203)
scala-steward Dec 15, 2021
42c3f8f
Update sbt-scalafmt to 2.4.5 (#204)
scala-steward Dec 15, 2021
3f2ced0
Add `killTree` and `killTreeForcibly` (#200)
reibitto Dec 15, 2021
2e83d28
Fix CI for Scala 3.1 (#208)
reibitto Dec 15, 2021
e5cd0d4
Backport killProcess bug fix (#210)
reibitto Dec 16, 2021
1f4e7c3
Increase test timeout
reibitto Dec 16, 2021
661da3d
Update sbt to 1.5.8 (#212)
scala-steward Dec 22, 2021
26a8ca2
Update sbt-welcome to 0.2.2 (#211)
scala-steward Dec 22, 2021
8b84f8f
Update Node.js to v16.13.2 (#217)
renovate[bot] Jan 11, 2022
a7c5510
Update sbt to 1.6.1 (#216)
scala-steward Jan 31, 2022
6c5ff55
Update scalafmt-core to 3.2.2 (#213)
scala-steward Jan 31, 2022
d43e5ce
Update sbt-scalafmt to 2.4.6 (#214)
scala-steward Jan 31, 2022
52d3afb
Update sbt-scoverage to 1.9.3 (#218)
scala-steward Jan 31, 2022
b6410fe
Update sbt-bloop to 1.4.12 (#219)
scala-steward Jan 31, 2022
1a3e751
Update scala-library to 2.13.8 (#220)
scala-steward Jan 31, 2022
a3bb1c1
Update sbt-ci-release to 1.5.10 (#221)
scala-steward Jan 31, 2022
9f21dcd
Update sbt-mdoc to 2.3.0 (#222)
scala-steward Jan 31, 2022
f0bd025
Update scalafmt-core to 3.4.0 (#225)
scala-steward Jan 31, 2022
3c2af26
Update Node.js to v16.14.0 (#232)
renovate[bot] Feb 9, 2022
9de4479
Update sbt to 1.6.2 (#226)
scala-steward Feb 9, 2022
c3de472
Update scala3-library to 3.1.1 (#227)
scala-steward Feb 9, 2022
407bda3
Update scalafmt-core to 3.4.2 (#231)
scala-steward Feb 9, 2022
3880459
Backport ProcessInput refactor (#234)
reibitto Feb 9, 2022
f29ac8f
Update actions/checkout action (#239)
renovate[bot] Mar 1, 2022
f43dbe1
Update Node.js to v16.14.1 (#240)
renovate[bot] Mar 16, 2022
3c4c515
Update Node.js to v16.14.2 (#241)
renovate[bot] Mar 18, 2022
19586f5
Update hmarr/auto-approve-action action to v2.2.0 (#245)
renovate[bot] Apr 2, 2022
1470ecf
Update hmarr/auto-approve-action action to v2.2.1 (#246)
renovate[bot] Apr 5, 2022
4de156a
Update scalafmt-core to 3.4.3 (#235)
scala-steward Apr 5, 2022
4de4f3d
Update sbt-buildinfo to 0.11.0 (#236)
scala-steward Apr 5, 2022
94e617d
Update sbt-bloop to 1.4.13 (#237)
scala-steward Apr 5, 2022
01fa2c5
Update scala-collection-compat to 2.7.0 (#243)
scala-steward Apr 5, 2022
73da528
Update sbt-mdoc to 2.3.2 (#244)
scala-steward Apr 5, 2022
9c2565b
Update actions/checkout action to v3.0.1 (#252)
renovate[bot] Apr 14, 2022
4f9df6d
Update actions/checkout action to v3.0.2 (#254)
renovate[bot] Apr 21, 2022
c76eacd
Update Node.js to v16.15.0 (#256)
renovate[bot] Apr 27, 2022
1878a59
Update scala3-library to 3.1.2 (#250)
scala-steward May 19, 2022
5ef188d
Update zio, zio-streams, zio-test, ... to 1.0.14 (#251)
scala-steward May 19, 2022
3b1f900
Update sbt-bloop to 1.5.0 (#255)
scala-steward May 19, 2022
02c4908
Update scalafmt-core to 3.5.3 (#257)
scala-steward May 19, 2022
fb0432b
Update Node.js to v16.15.1 (#259)
renovate[bot] Jun 2, 2022
c072e5f
Remove sbt-bloop
guizmaii Dec 16, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
auto-approve:
runs-on: ubuntu-20.04
steps:
- uses: hmarr/auto-approve-action@v2.1.0
- uses: hmarr/auto-approve-action@v2.2.1
if: github.actor == 'scala-steward' || github.actor == 'renovate[bot]'
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ jobs:
timeout-minutes: 30
steps:
- name: Checkout current branch
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3.0.2
with:
fetch-depth: 0
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v13
with:
java-version: adopt@1.11
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Lint code
Expand All @@ -33,9 +35,11 @@ jobs:
timeout-minutes: 60
steps:
- name: Checkout current branch
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3.0.2
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v13
with:
java-version: adopt@1.11
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Check Document Generation
Expand All @@ -47,11 +51,11 @@ jobs:
strategy:
fail-fast: false
matrix:
java: ['adopt@1.8', 'adopt@1.11']
scala: ['2.11.12', '2.12.14', '2.13.6', '3.0.1']
java: ['adopt@1.11']
scala: ['2.11.12', '2.12.15', '2.13.8', '3.1.2']
steps:
- name: Checkout current branch
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3.0.2
with:
fetch-depth: 0
- name: Setup Scala and Java
Expand All @@ -77,11 +81,13 @@ jobs:
if: github.event_name != 'pull_request'
steps:
- name: Checkout current branch
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3.0.2
with:
fetch-depth: 0
- name: Setup Scala and Java
uses: olafurpg/setup-scala@v13
with:
java-version: adopt@1.11
- name: Cache scala dependencies
uses: coursier/cache-action@v6
- name: Release artifacts
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Website

on:
push:
branches: [master]
branches: [ master ]
release:
types:
- published
Expand All @@ -13,8 +13,10 @@ jobs:
timeout-minutes: 30
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: olafurpg/setup-scala@v13
with:
java-version: adopt@1.11
- run: sbt docs/docusaurusPublishGhpages
env:
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17.6
16.15.1
21 changes: 11 additions & 10 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
version = "2.7.5"
version = "3.5.3"
maxColumn = 120
align = most
align.preset = most
align.multiline = false
continuationIndent.defnSite = 2
assumeStandardLibraryStripMargin = true
docstrings = JavaDoc
docstrings.style = Asterisk
docstrings.wrap = "no"
lineEndings = preserve
includeCurlyBraceInSelectChains = false
danglingParentheses = true
spaces {
inImportCurlyBraces = true
}
danglingParentheses.preset = true
optIn.annotationNewlines = true
newlines.alwaysBeforeMultilineDef = false
runner.dialect = scala213
rewrite.rules = [RedundantBraces]

rewrite.rules = [SortImports, RedundantBraces]

rewrite.redundantBraces.generalExpressions = false
rewriteTokens = {
"⇒": "=>"
"→": "->"
"←": "<-"
}
}
14 changes: 7 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import sbtwelcome._
inThisBuild(
List(
organization := "dev.zio",
homepage := Some(url("https://zio.github.io/zio-process/")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
homepage := Some(url("https://zio.github.io/zio-process/")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"jdegoes",
Expand Down Expand Up @@ -42,12 +42,12 @@ usefulTasks := Seq(
UsefulTask("", "testOnly *.YourSpec -- -t \"YourLabel\"", "Only runs tests with matching term")
)

val zioVersion = "1.0.9"
val zioVersion = "1.0.14"

libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"org.scala-lang.modules" %% "scala-collection-compat" % "2.5.0",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.7.0",
"dev.zio" %% "zio-test" % zioVersion % "test",
"dev.zio" %% "zio-test-sbt" % zioVersion % "test"
)
Expand All @@ -67,16 +67,16 @@ lazy val docs = project
.in(file("zio-process-docs"))
.settings(
publish / skip := true,
moduleName := "zio-process-docs",
moduleName := "zio-process-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion
),
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(root),
ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api",
ScalaUnidoc / unidoc / target := (LocalRootProject / baseDirectory).value / "website" / "static" / "api",
cleanFiles += (ScalaUnidoc / unidoc / target).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(Compile / unidoc).value,
docusaurusCreateSite := docusaurusCreateSite.dependsOn(Compile / unidoc).value,
docusaurusPublishGhpages := docusaurusPublishGhpages.dependsOn(Compile / unidoc).value
)
.dependsOn(root)
Expand Down
1 change: 1 addition & 0 deletions docs/overview/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Here's list of contents available:

- **[Basics](basics.md)** — Creating a description of a command and transforming its output
- **[Piping](piping.md)** — Creating a pipeline of commands
- **[Interactive Processes](interactive_processes.md)** — Communicating with an interactive process
- **[Other](other.md)** — Miscellaneous operations such as settings the working direction, inheriting I/O, etc.

## Installation
Expand Down
30 changes: 30 additions & 0 deletions docs/overview/interactive_processes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
id: overview_interactive_processes
title: "Interactive Processes"
---

Sometimes you want to interact with a process in a back-and-forth manner by sending requests to the process and receiving responses back. For example, interacting with a repl-like process like `node -i`, `python -i`, etc. or an ssh server.

Here is an example of communicating with an interactive Python shell:

```scala mdoc:invisible
import zio._
import zio.process._
import java.nio.charset.StandardCharsets
```

```scala mdoc:silent
for {
commandQueue <- Queue.unbounded[Chunk[Byte]]
process <- Command("python", "-qi").stdin(ProcessInput.fromQueue(commandQueue)).run
_ <- process.stdout.linesStream.foreach { response =>
ZIO.debug(s"Response from REPL: $response")
}.forkDaemon
_ <- commandQueue.offer(Chunk.fromArray("1+1\n".getBytes(StandardCharsets.UTF_8)))
_ <- commandQueue.offer(Chunk.fromArray("2**8\n".getBytes(StandardCharsets.UTF_8)))
_ <- commandQueue.offer(Chunk.fromArray("import random\nrandom.randint(1, 100)\n".getBytes(StandardCharsets.UTF_8)))
_ <- commandQueue.offer(Chunk.fromArray("exit()\n".getBytes(StandardCharsets.UTF_8)))
} yield ()
```

You would probably want to create a helper for the repeated code, but this just a minimal example to help get you started.
30 changes: 16 additions & 14 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ import sbtbuildinfo._

object BuildHelper {
private val versions: Map[String, String] = {
import org.snakeyaml.engine.v2.api.{ Load, LoadSettings }
import org.snakeyaml.engine.v2.api.{Load, LoadSettings}

import java.util.{ List => JList, Map => JMap }
import java.util.{List => JList, Map => JMap}
import scala.jdk.CollectionConverters._

val doc = new Load(LoadSettings.builder().build())
val doc = new Load(LoadSettings.builder().build())
.loadFromReader(scala.io.Source.fromFile(".github/workflows/ci.yml").bufferedReader())
val yaml = doc.asInstanceOf[JMap[String, JMap[String, JMap[String, JMap[String, JMap[String, JList[String]]]]]]]
val list = yaml.get("jobs").get("test").get("strategy").get("matrix").get("scala").asScala
list.map(v => (v.split('.').take(2).mkString("."), v)).toMap
list.map { v =>
val vs = v.split('.'); val init = vs.take(vs(0) match { case "2" => 2; case _ => 1 }); (init.mkString("."), v)
}.toMap
}

private val Scala211: String = versions("2.11")
private val Scala212: String = versions("2.12")
private val Scala213: String = versions("2.13")
private val Scala3: String = versions("3.0")
private val Scala3: String = versions("3")

private val stdOptions = Seq(
"-encoding",
Expand Down Expand Up @@ -59,7 +60,8 @@ object BuildHelper {
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
"-Xlint:_,-type-parameter-shadow",
"-Xsource:2.13"
"-Xsource:2.13",
"-target:jvm-1.8"
)

private def extraOptions(scalaVersion: String) =
Expand All @@ -75,24 +77,24 @@ object BuildHelper {
"-opt:l:inline",
"-opt-inline-from:<source>"
) ++ stdOptsUpto212 ++ stdOptsUpto211
case Some((3, 0)) =>
case Some((3, _)) =>
Seq("-noindent")
case _ =>
case _ =>
Seq("-Xexperimental") ++ stdOptsUpto212 ++ stdOptsUpto211
}

def buildInfoSettings(packageName: String) =
Seq(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, isSnapshot),
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, isSnapshot),
buildInfoPackage := packageName,
buildInfoObject := "BuildInfo"
buildInfoObject := "BuildInfo"
)

def stdSettings(prjName: String) = Seq(
name := s"$prjName",
crossScalaVersions := Seq(Scala211, Scala212, Scala213, Scala3),
name := s"$prjName",
crossScalaVersions := Seq(Scala211, Scala212, Scala213, Scala3),
ThisBuild / scalaVersion := Scala213,
scalacOptions := stdOptions ++ extraOptions(scalaVersion.value),
scalacOptions := stdOptions ++ extraOptions(scalaVersion.value),
incOptions ~= (_.withLogRecompileOnMacro(false))
)
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.5.5
sbt.version = 1.6.2
15 changes: 7 additions & 8 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.8.2")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.22")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.8")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
addSbtPlugin("com.github.reibitto" % "sbt-welcome" % "0.2.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.2")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.github.reibitto" % "sbt-welcome" % "0.2.2")

libraryDependencies += "org.snakeyaml" % "snakeyaml-engine" % "2.3"
Loading