Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SubprocessStdoutTests on Windows #3289

Merged
merged 4 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 17 additions & 4 deletions integration/feature/subprocess-stdout/repo/build.sc
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
import scala.util.Properties
import mill._


def inheritInterleaved = T {
for (i <- Range.inclusive(1, 9)) {
println("print stdout" + i)
os.proc("echo", "proc stdout" + i).call(stdout = os.Inherit)
val echoCommandStdout =
if (Properties.isWin) Seq("cmd.exe", "/C", s"echo proc stdout${i}")
else Seq("echo", s"proc stdout${i}")
os.proc(echoCommandStdout).call(stdout = os.Inherit)
System.err.println("print stderr" + i)
os.proc("bash", "-c", s"echo proc stderr${i} >&2").call(stderr = os.Inherit)
val echoCommandStderr =
if (Properties.isWin) Seq("cmd.exe", "/C", s"echo proc stderr${i}>&2")
else Seq("bash", "-c", s"echo proc stderr${i} >&2")
os.proc(echoCommandStderr).call(stderr = os.Inherit)
}
}

def inheritRaw = T{
println("print stdoutRaw")
os.proc("echo", "proc stdoutRaw").call(stdout = os.InheritRaw)
val echoCommandStdoutRaw =
if (Properties.isWin) Seq("cmd.exe", "/C", "echo proc stdoutRaw")
else Seq("echo", "proc stdoutRaw")
os.proc(echoCommandStdoutRaw).call(stdout = os.InheritRaw)
System.err.println("print stderrRaw")
os.proc("bash", "-c", "echo proc stderrRaw >&2").call(stderr = os.InheritRaw)
val echoCommandStderrRaw =
if (Properties.isWin) Seq("cmd.exe", "/C", "echo proc stderrRaw>&2")
else Seq("bash", "-c", "echo proc stderrRaw >&2")
os.proc(echoCommandStderrRaw).call(stderr = os.InheritRaw)
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object SubprocessStdoutTests extends IntegrationTestSuite {
|print stdout9
|proc stdout9
|print stderr9
|proc stderr9""".stripMargin
|proc stderr9""".stripMargin.replaceAll("\r\n", "\n")
)
)

Expand All @@ -66,7 +66,7 @@ object SubprocessStdoutTests extends IntegrationTestSuite {
"""print stdoutRaw
|proc stdoutRaw
|print stderrRaw
|proc stderrRaw""".stripMargin
|proc stderrRaw""".stripMargin.replaceAll("\r\n", "\n")
)
)
} else {
Expand All @@ -77,7 +77,7 @@ object SubprocessStdoutTests extends IntegrationTestSuite {
"""print stdoutRaw
|print stderrRaw
|proc stdoutRaw
|proc stderrRaw""".stripMargin.linesIterator.toSet.subsetOf(
|proc stderrRaw""".stripMargin.replaceAll("\r\n", "\n").linesIterator.toSet.subsetOf(
res2.linesIterator.toSet
)
)
Expand Down
Loading