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

the compiler should respond to interrupts in a principled fashion #5172

Closed
scabug opened this issue Nov 10, 2011 · 4 comments
Closed

the compiler should respond to interrupts in a principled fashion #5172

scabug opened this issue Nov 10, 2011 · 4 comments

Comments

@scabug
Copy link

scabug commented Nov 10, 2011

An interruptible compiler is almost as good as a fast one!

Assigning to self.

@scabug
Copy link
Author

scabug commented Nov 10, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5172?orig=1
Reporter: @paulp

@SethTisue
Copy link
Member

labeling as "good first issue" seems it plausible to me we could at least check this between phases. someone could at least look into it. the goal would be to hook it up to control-C in sbt

@dm4x
Copy link

dm4x commented Jun 12, 2019

Hi, @SethTisue @scabug
I try to interrupt compiler with ctrl-c in linux and don't have problems with that in current version:

dm4x@zi0n:~/workspace/Scala/ScalaLang/scala$ scalac -version
Scala compiler version 2.12.8-20190113-111201-unknown -- Copyright 2002-2018, LAMP/EPFL and Lightbend, Inc.

Usual run:

dm4x@zi0n:~/workspace/Scala/ScalaLang/scala$ scalac ./src/compiler/scala/tools/util/PathResolver.scala 
./src/compiler/scala/tools/util/PathResolver.scala:20: error: object CloseableRegistry is not a member of package scala.tools.nsc
import scala.tools.nsc.{CloseableRegistry, Settings}
       ^
./src/compiler/scala/tools/util/PathResolver.scala:209: error: not found: type CloseableRegistry
final class PathResolver(settings: Settings, closeableRegistry: CloseableRegistry = new CloseableRegistry) {
                                                                ^
./src/compiler/scala/tools/util/PathResolver.scala:34: error: not found: type IterableOnce
  implicit class MkLines(val t: IterableOnce[_]) extends AnyVal {
                                ^
./src/compiler/scala/tools/util/PathResolver.scala:45: error: value mkLines is not a member of Iterator[String]
    def asLines = s.trim.stripMargin.linesIterator.mkLines
                                                   ^
./src/compiler/scala/tools/util/PathResolver.scala:193: error: not found: type CloseableRegistry
      val registry = new CloseableRegistry
                         ^
./src/compiler/scala/tools/util/PathResolver.scala:209: error: not found: type CloseableRegistry
final class PathResolver(settings: Settings, closeableRegistry: CloseableRegistry = new CloseableRegistry) {
                                                                                        ^
./src/compiler/scala/tools/util/PathResolver.scala:301: error: value mkLines is not a member of List[scala.tools.nsc.util.ClassPath]
      Console print (xs mkLines (s"After java boot/extdirs classpath has ${xs.size} entries:", indented = true))
                        ^
./src/compiler/scala/tools/util/PathResolver.scala:301: error: not found: value indented
      Console print (xs mkLines (s"After java boot/extdirs classpath has ${xs.size} entries:", indented = true))
                                                                                               ^
8 errors found
dm4x@zi0n:~/workspace/Scala/ScalaLang/scala$

Interrupted run:

dm4x@zi0n:~/workspace/Scala/ScalaLang/scala$ scalac ./src/compiler/scala/tools/util/PathResolver.scala 
./src/compiler/scala/tools/util/PathResolver.scala:20: error: object CloseableRegistry is not a member of package scala.tools.nsc
import scala.tools.nsc.{CloseableRegistry, Settings}
       ^
./src/compiler/scala/tools/util/PathResolver.scala:209: error: not found: type CloseableRegistry
final class PathResolver(settings: Settings, closeableRegistry: CloseableRegistry = new CloseableRegistry) {
                                                                ^
./src/compiler/scala/tools/util/PathResolver.scala:34: error: not found: type IterableOnce
  implicit class MkLines(val t: IterableOnce[_]) extends AnyVal {
                                ^
^Cdm4x@zi0n:~/workspace/Scala/ScalaLang/scala$

In sbt interrupted run looks like that:

dm4x@zi0n:~/workspace/Scala/ScalaLang/scala$ sbt dist/mkPack
[info] Loading global plugins from /home/dm4x/.sbt/1.0/plugins
[info] Loading settings for project scala-build-build from plugins.sbt ...
[info] Loading project definition from /home/dm4x/workspace/Scala/ScalaLang/scala/project/project
[info] Loading settings for project scala-build from plugins.sbt ...
[info] Loading project definition from /home/dm4x/workspace/Scala/ScalaLang/scala/project
[info] Loading settings for project root from build.sbt ...
[info] Resolving key references (14335 settings) ...
[info] *** Welcome to the sbt build definition for Scala! ***
[info] Check README.md for more information.
[info] Updating library...
[info] Done updating.
[info] Updating reflect...
[info] Updating bootstrap...
[info] Done updating.
[info] Updating compiler...
[info] Done updating.
[info] Compiling 530 Scala sources and 33 Java sources to /home/dm4x/workspace/Scala/ScalaLang/scala/build/quick/classes/library ...
[info] Done updating.
[info] Updating interactive...
[info] Updating scaladoc...
[info] Updating scalap...
[info] Done updating.
[info] Updating repl...
[info] Done updating.
[info] Done updating.
[info] Done updating.
[info] Updating repl-frontend...
[info] Done updating.
^C
[warn] Canceling execution...
[warn] there were 23 feature warnings; re-run with -feature for details
[warn] one warning found
[info] Compilation has been cancelled
[error] Total time: 9 s, completed Jun 12, 2019 4:41:03 PM

Interrupted on another stage:

dm4x@zi0n:~/workspace/Scala/ScalaLang/scala$ sbt dist/mkPack
[info] Loading global plugins from /home/dm4x/.sbt/1.0/plugins
[info] Loading settings for project scala-build-build from plugins.sbt ...
[info] Loading project definition from /home/dm4x/workspace/Scala/ScalaLang/scala/project/project
[info] Loading settings for project scala-build from plugins.sbt ...
[info] Loading project definition from /home/dm4x/workspace/Scala/ScalaLang/scala/project
[info] Loading settings for project root from build.sbt ...
[info] Resolving key references (14335 settings) ...
[info] *** Welcome to the sbt build definition for Scala! ***
[info] Check README.md for more information.
[info] Compiling 530 Scala sources and 33 Java sources to /home/dm4x/workspace/Scala/ScalaLang/scala/build/quick/classes/library ...
^C
[warn] Canceling execution...
[info] Compilation has been cancelled
[error] Total time: 5 s, completed Jun 12, 2019 4:43:18 PM

Looks fine for me.

P.S.

$ uname -a
Linux zi0n 4.20.6-arch1-1-ARCH #1 SMP PREEMPT Thu Jan 31 08:22:01 UTC 2019 x86_64 GNU/Linux

@eed3si9n
Copy link
Member

This was done in scala/scala#6479

@SethTisue SethTisue modified the milestones: Backlog, 2.12.7 Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants