Break triggered execution if Project.terminateWatch is true for pressed keys. Default is to terminate on enter only now.

git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@979 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
dmharrah 2009-09-01 14:10:09 +00:00
parent cec0079304
commit e68142427b
2 changed files with 4 additions and 2 deletions

View File

@ -585,12 +585,13 @@ object Main
private def compileContinuously(project: Project) = executeContinuously(project, "test-compile")
private def executeContinuously(project: Project, action: String)
{
def shouldTerminate: Boolean = (System.in.available > 0) && project.terminateWatch(System.in.read()) || shouldTerminate
if(checkAction(project, action))
{
SourceModificationWatch.watchUntil(project, ContinuousCompilePollDelaySeconds)(System.in.available() > 0)
SourceModificationWatch.watchUntil(project, ContinuousCompilePollDelaySeconds)(shouldTerminate)
{
handleAction(project, action)
Console.println("Waiting for source changes... (press any key to interrupt)")
Console.println("Waiting for source changes... (press enter to interrupt)")
}
while (System.in.available() > 0) System.in.read()
}

View File

@ -240,6 +240,7 @@ trait Project extends TaskManager with Dag[Project] with BasicEnvironment
/** A `PathFinder` that determines the files watched when an action is run with a preceeding ~ when this is the current
* project. This project does not need to include the watched paths for projects that this project depends on.*/
def watchPaths: PathFinder = Path.emptyPathFinder
def terminateWatch(key: Int): Boolean = key == 10
protected final override def parentEnvironment = info.parent