deaton.dg
deaton.dg

Reputation: 1352

How do I get a `Pipe` to the standard input/output/error in Swift?

When using Process in Swift, if you do not specify the .standardInput, .standardOutput, or .standardError properties, the Process inherits the standard input/output/error of the caller, which can be quite useful. But let's say that, for example, I want to tell a Process to send its output to the inherited standard error. It seems to me I would want to do something like process.standardOutput = ProcessInfo.processInfo.standardError, but ProcessInfo has no standardError property. How am I supposed to do something like this?

Upvotes: 3

Views: 491

Answers (1)

deaton.dg
deaton.dg

Reputation: 1352

Of course I find the answer to this immediately after posting this question.

The desired objects are FileHandle.standardInput, FileHandle.standardOutput, and FileHandle.standardError.

Upvotes: 3

Related Questions