@@ -21,13 +21,14 @@ object ScriptTestEnv {
2121 def psep : String = sys.props(" path.separator" )
2222 def userDir : String = sys.props(" user.dir" ).norm
2323 def testCwd = envOrElse(" TEST_CWD" , " " ).norm // optional working directory TEST_CWD
24+ def verbose = envOrElse(" VERBOSE" , " " ).nonEmpty
2425
2526 def whichJava : String = whichExe(" java" )
2627 def whichBash : String = whichExe(" bash" )
2728
2829 lazy val workingDirectory : String = {
2930 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)
3132 testCwd
3233 else
3334 userDir // userDir, if TEST_CWD not set
@@ -37,7 +38,7 @@ object ScriptTestEnv {
3738 if ! test.isDirectory then
3839 printf(" warning: not found below working directory: %s\n " , test.norm)
3940
40- printf(" working directory is [%s]\n " , dirstr)
41+ if verbose then printf(" working directory is [%s]\n " , dirstr)
4142 dirstr
4243 }
4344
@@ -106,7 +107,7 @@ object ScriptTestEnv {
106107 // a misconfigured environment (e.g., script is not executable) can prevent script execution
107108 val validTest = ! stderr.exists(_.contains(" Permission denied" ))
108109 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)
110111 stderr.foreach { System .err.printf(" stderr [%s]\n " , _) }
111112
112113 (validTest, exitVal, stdout.reverse, stderr.reverse)
@@ -275,8 +276,7 @@ object ScriptTestEnv {
275276 (" MSYS" , msyshome),
276277 (" SHELLOPTS" , shellopts),
277278 ).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)
280280 pairs
281281 }
282282
0 commit comments