Skip to content

Commit

Permalink
Add InputSource.FromParent
Browse files Browse the repository at this point in the history
  • Loading branch information
pgreze authored Jun 27, 2024
1 parent 3f0fb93 commit dc4d950
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/kotlin/com/github/pgreze/process/InputSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ sealed class InputSource {
*/
class FromStream(val handler: suspend (OutputStream) -> Unit) : InputSource()

/**
* Natively supported parent provided redirection.
* @see ProcessBuilder.Redirect.INHERIT
*/
object FromParent : InputSource()

@Suppress("BlockingMethodInNonBlockingContext")
companion object {
@JvmStatic
Expand All @@ -41,4 +47,5 @@ sealed class InputSource {
internal fun InputSource.toNative() = when (this) {
is InputSource.FromFile -> ProcessBuilder.Redirect.from(file)
is InputSource.FromStream -> ProcessBuilder.Redirect.PIPE
is InputSource.FromParent -> ProcessBuilder.Redirect.INHERIT
}

0 comments on commit dc4d950

Please sign in to comment.