function detectStreamKind(stream, std) {
    return (
        stream == null ? "ignore" :
        // `|| !std.isTTY` is needed for the workaround of https://github.com/nodejs/node/issues/5620
        stream !== std || !std.isTTY ? "pipe" :
        /* else */ stream
    )
}
Converts a given stream to an option for `child_process.spawn`.

@param {stream.Readable|stream.Writable|null} stream - An original stream to convert.
@param {process.stdin|process.stdout|process.stderr} std - A standard stream for this option.
@returns {string|stream.Readable|stream.Writable} An option for `child_process.spawn`.