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

Silence stderr from os.proc calls #111

Merged
merged 2 commits into from
May 21, 2023
Merged
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
10 changes: 5 additions & 5 deletions core/src/de/tobiasroeser/mill/vcs/version/VcsVersion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trait VcsVersion extends Module {
private[this] def calcVcsState(logger: Logger): VcsState = {
val curHeadRaw =
try {
Option(os.proc("git", "rev-parse", "HEAD").call(cwd = vcsBasePath).out.trim())
Option(os.proc("git", "rev-parse", "HEAD").call(cwd = vcsBasePath, stderr = os.Pipe).out.trim())
} catch {
case e: SubprocessException =>
logger.error(s"${vcsBasePath} is not a git repository.")
Expand All @@ -40,7 +40,7 @@ trait VcsVersion extends Module {
curHead
.map(curHead =>
os.proc("git", "describe", "--exact-match", "--tags", "--always", curHead)
.call(cwd = vcsBasePath)
.call(cwd = vcsBasePath, stderr = os.Pipe)
.out
.text()
.trim
Expand All @@ -54,7 +54,7 @@ trait VcsVersion extends Module {
try {
Option(
os.proc("git", "describe", "--abbrev=0", "--tags")
.call()
.call(stderr = os.Pipe)
.out
.text()
.trim()
Expand All @@ -79,15 +79,15 @@ trait VcsVersion extends Module {
case _ => Seq()
},
"--count"
).call()
).call(stderr = os.Pipe)
.out
.trim()
.toInt
}
.getOrElse(0)
}

val dirtyHashCode: Option[String] = Option(os.proc("git", "diff").call().out.text().trim()).flatMap {
val dirtyHashCode: Option[String] = Option(os.proc("git", "diff").call(stderr = os.Pipe).out.text().trim()).flatMap {
case "" => None
case s => Some(Integer.toHexString(s.hashCode))
}
Expand Down