Skip to content

Commit a30362c

Browse files
committed
use a uniform classloader for hooks and main pipeline
1 parent 70a43c6 commit a30362c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/groovy/bpipe/Runner.groovy

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ class Runner {
156156
@CompileStatic
157157
public static void main(String [] arguments) {
158158

159+
160+
159161
List<String> args = arguments as List<String>
160162

161163
if(!BPIPE_HOME || BPIPE_HOME.isEmpty()) {
@@ -493,7 +495,7 @@ class Runner {
493495
Config.config.breakAt = ((String)opts['u']).split(",")
494496
}
495497

496-
def gcl = new GroovyClassLoader()
498+
def gcl = new GroovyClassLoader(Runner.class.classLoader.rootLoader)
497499

498500
if('parameters' in Config.userConfig) {
499501
Config.userConfig.parameters.collect { Map.Entry<String,Object> e ->
@@ -538,7 +540,7 @@ class Runner {
538540
script.setProperty("args", pipelineArgs);
539541

540542
// If there are hooks in the hooks folder, run those
541-
executeHooks()
543+
executeHooks(gcl)
542544

543545
// RUN it
544546
try {
@@ -986,10 +988,10 @@ class Runner {
986988
* Look for files in the hooks directory and execute each one to enable them to attach
987989
* event listeners to enable functionality they care about.
988990
*/
989-
static void executeHooks() {
991+
static void executeHooks(GroovyClassLoader gcl) {
990992
List<File> hookFiles = HOOKS_DIRECTORY.listFiles().findAll { it.name.endsWith('.groovy') }.sort { it.name }
991993

992-
GroovyShell shell = new GroovyShell()
994+
GroovyShell shell = new GroovyShell(gcl)
993995

994996
hookFiles.each { File hookFile ->
995997
shell.run(hookFile, [])

0 commit comments

Comments
 (0)