Skip to content

Commit 478a996

Browse files
graemerochergraemerocher
authored andcommitted
fix for GRAILS-11514 - "grails run-app" running application silently quits after a while
1 parent 98eb36e commit 478a996

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/fork/ForkedGrailsProcess.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,18 @@ abstract class ForkedGrailsProcess {
331331
ServerSocket parentAvailabilityServer = new ServerSocket(0)
332332
def parentPort = parentAvailabilityServer.localPort
333333
System.setProperty(PARENT_PROCESS_PORT, String.valueOf(parentPort))
334+
335+
336+
Thread.start {
337+
while(!parentAvailabilityServer.isClosed()) {
338+
try {
339+
// simply accept and close the socket
340+
parentAvailabilityServer.accept().close()
341+
} catch (e) {
342+
// ignore
343+
}
344+
}
345+
}
334346
Runtime.addShutdownHook {
335347
try {
336348
parentAvailabilityServer?.close()

0 commit comments

Comments
 (0)