Merge pull request #319 from eed3si9n/wip/space

Fix unintended glob expansion
This commit is contained in:
eugene yokota 2020-01-08 12:53:26 -05:00 committed by GitHub
commit 43498a2e08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -180,4 +180,14 @@ object SbtRunnerTest extends SimpleTestSuite with PowerAssertions {
assert(out.contains[String]("[info] HelloTest"))
()
}
test("quoted * should not glob expand to local files") {
val out = sbtProcess("testOnly * ", "--no-colors", "-v", "-debug").!!.linesIterator.toList
// Ensure the "*" doesn't get glob expanded to individual files or directories
// (e.g. Hello.scala gets added to the testOnly arguments) https://github.com/sbt/sbt/issues/5343
assert(!out.exists(x => x.contains("testOnly") && x.contains("Hello.scala")))
assert(out.contains[String]("[info] HelloTest"))
()
}
}

View File

@ -353,8 +353,8 @@ run() {
local retarr=()
java_args=($JAVA_OPTS)
sbt_options0=(${SBT_OPTS:-$default_sbt_opts})
miniscript=$(map_args "${sbt_options0[@]}") && eval ${miniscript/retarr/sbt_options}
miniscript=$(map_args "$@") && eval ${miniscript/retarr/args1}
miniscript=$(map_args "${sbt_options0[@]}") && eval "${miniscript/retarr/sbt_options}"
miniscript=$(map_args "$@") && eval "${miniscript/retarr/args1}"
# process the combined args, then reset "$@" to the residuals
process_args "${args1[@]}"
vlog "[sbt_options] $(declare -p sbt_options)"