@@ -21,13 +21,14 @@ object ScriptTestEnv {
21
21
def psep : String = sys.props(" path.separator" )
22
22
def userDir : String = sys.props(" user.dir" ).norm
23
23
def testCwd = envOrElse(" TEST_CWD" , " " ).norm // optional working directory TEST_CWD
24
+ def verbose = envOrElse(" VERBOSE" , " " ).nonEmpty
24
25
25
26
def whichJava : String = whichExe(" java" )
26
27
def whichBash : String = whichExe(" bash" )
27
28
28
29
lazy val workingDirectory : String = {
29
30
val dirstr = if testCwd.nonEmpty then
30
- printf(" TEST_CWD set to [%s]\n " , testCwd)
31
+ if verbose then printf(" TEST_CWD set to [%s]\n " , testCwd)
31
32
testCwd
32
33
else
33
34
userDir // userDir, if TEST_CWD not set
@@ -37,7 +38,7 @@ object ScriptTestEnv {
37
38
if ! test.isDirectory then
38
39
printf(" warning: not found below working directory: %s\n " , test.norm)
39
40
40
- printf(" working directory is [%s]\n " , dirstr)
41
+ if verbose then printf(" working directory is [%s]\n " , dirstr)
41
42
dirstr
42
43
}
43
44
@@ -106,7 +107,7 @@ object ScriptTestEnv {
106
107
// a misconfigured environment (e.g., script is not executable) can prevent script execution
107
108
val validTest = ! stderr.exists(_.contains(" Permission denied" ))
108
109
if ! validTest then
109
- printf(" \n unable to execute script, return value is %d\n " , exitVal)
110
+ System .err. printf(" \n unable to execute script, return value is %d\n " , exitVal)
110
111
stderr.foreach { System .err.printf(" stderr [%s]\n " , _) }
111
112
112
113
(validTest, exitVal, stdout.reverse, stderr.reverse)
@@ -275,8 +276,7 @@ object ScriptTestEnv {
275
276
(" MSYS" , msyshome),
276
277
(" SHELLOPTS" , shellopts),
277
278
).filter { case (name, valu) => valu.nonEmpty }
278
- for (k, v) <- pairs do
279
- printf(" %s : %s\n " , k ,v)
279
+ if verbose then for (k, v) <- pairs do printf(" %s : %s\n " , k ,v)
280
280
pairs
281
281
}
282
282
0 commit comments