Make standard output/error redirection optional. #141

Merged
merged 1 commit into from Jul 5, 2012

Projects

None yet

4 participants

Owner
dragos commented Jul 4, 2012

By default, std out and error are redirected to the log file. This makes it
difficult to do println debugging, and often each printed character ends up
on a separate line in the log file. This PR makes it an option.

Fixes #1001133

Owner
misto commented Jul 4, 2012

Thanks!

@dotta dotta and 1 other commented on an outdated diff Jul 4, 2012
...core/src/scala/tools/eclipse/logging/LogManager.scala
+ if (event.getProperty == RedirectStdErrOut) {
+ val enable = event.getNewValue.asInstanceOf[Boolean]
+ if (enable) redirectStdOutAndStdErr()
+ else disableRedirectStdOutAndStdErr()
+
+ // we need to restart the presentation compilers so that
+ // the std out/err streams are refreshed by Console.in/out
+ if (enable != event.getOldValue.asInstanceOf[Boolean])
+ restartPCs()
+ }
+ }
+
+ /** Restart all presentation compilers in the workspace. Need to do it in order
+ * for them to pick up the new std out/err streams.
+ */
+ private def restartPCs() {
dotta
dotta Jul 4, 2012 Owner

I don't think this belongs here. Maybe ScalaProject ScalaPlugin object?

dragos
dragos Jul 4, 2012 Owner

It's for all Scala projects, so ti can't be in ScalaProject. But ScalaPlugin is a better place.

dotta
dotta Jul 4, 2012 Owner

Taking this further, it would be nice if you could register a listener in ScalaPlugin that listen for changes for event.getProperty == RedirectStdErrOut and restarts the PCs (this way the method restartPCs could be private to ScalaPlugin).

@dragos dragos Make standard output/error redirection optional.
By default, std out and error are redirected to the log file. This makes it
difficult to do println debugging, and often each printed character ends up
on a separate line in the log file. This PR makes it an option.

Fixes #1001133
a8e7fb2
@dragos dragos merged commit c61528c into scala-ide:master Jul 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment