From ce12e1d64d6b0b62609f061d3773a7e8b35849c3 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 30 Nov 2021 16:50:05 -0500 Subject: Auto flush for streams for stdin/out in slang-test (#2035) * #include an absolute path didn't work - because paths were taken to always be relative. * Move StreamType from Process to StdStreamType in slang-stream.h * Disable buffering for stdout/stderr for slang-test. * Improve comment. --- source/core/unix/slang-unix-process.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/core/unix') diff --git a/source/core/unix/slang-unix-process.cpp b/source/core/unix/slang-unix-process.cpp index 4e8344486..2c84ef08f 100644 --- a/source/core/unix/slang-unix-process.cpp +++ b/source/core/unix/slang-unix-process.cpp @@ -435,12 +435,12 @@ static const int kCannotExecute = 126; ::close(stderrPipe[1]); ::close(stdinPipe[0]); - RefPtr streams[Index(Process::StreamType::CountOf)]; + RefPtr streams[Index(StdStreamType::CountOf)]; // Previously code didn't need to close, so we'll make stream not own the handles - streams[Index(Process::StreamType::StdOut)] = new UnixPipeStream(stdoutPipe[0], FileAccess::Read, true); - streams[Index(Process::StreamType::ErrorOut)] = new UnixPipeStream(stderrPipe[0], FileAccess::Read, true); - streams[Index(Process::StreamType::StdIn)] = new UnixPipeStream(stdinPipe[1], FileAccess::Write, true); + streams[Index(StdStreamType::Out)] = new UnixPipeStream(stdoutPipe[0], FileAccess::Read, true); + streams[Index(StdStreamType::ErrorOut)] = new UnixPipeStream(stderrPipe[0], FileAccess::Read, true); + streams[Index(StdStreamType::In)] = new UnixPipeStream(stdinPipe[1], FileAccess::Write, true); outProcess = new UnixProcess(childPid, streams[0].readRef()); return SLANG_OK; @@ -481,21 +481,21 @@ static const int kCannotExecute = 126; nanosleep(&timeSpec, nullptr); } -/* static */SlangResult Process::getStdStream(StreamType type, RefPtr& out) +/* static */SlangResult Process::getStdStream(StdStreamType type, RefPtr& out) { switch (type) { - case StreamType::StdIn: + case StdStreamType::In: { out = new UnixPipeStream(STDIN_FILENO, FileAccess::Read, false); break; } - case StreamType::StdOut: + case StdStreamType::Out: { out = new UnixPipeStream(STDOUT_FILENO, FileAccess::Write, false); break; } - case StreamType::ErrorOut: + case StdStreamType::ErrorOut: { out = new UnixPipeStream(STDERR_FILENO, FileAccess::Write, false); break; -- cgit v1.2.3