From 870a4c1282069bec1813e9f2c576b41c84fac856 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sun, 28 Feb 2021 01:18:04 +1300 Subject: [PATCH] api: fix compile stage runtime.compiled always returned false as it was undefined. This made the code think it's a run-only language, and never called the compile script. --- api/src/executor/job.js | 10 ++++++---- api/src/runtime.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/api/src/executor/job.js b/api/src/executor/job.js index c99ecb9..1b2aaaa 100644 --- a/api/src/executor/job.js +++ b/api/src/executor/job.js @@ -131,10 +131,12 @@ class Job { if(this.state != job_states.PRIMED) throw new Error('Job must be in primed state, current state: ' + this.state.toString()); logger.info(`Executing job uuid=${this.uuid} uid=${this.uid} gid=${this.gid} runtime=${this.runtime.toString()}`); logger.debug('Compiling'); - const compile = this.runtime.compiled && await this.safe_call( - path.join(this.runtime.pkgdir, 'compile'), - [this.main, ...this.files], - this.timeouts.compile); + var compile = undefined; + if(this.runtime.compiled) + compile = await this.safe_call( + path.join(this.runtime.pkgdir, 'compile'), + this.files.map(x=>x.name), + this.timeouts.compile); logger.debug('Running'); diff --git a/api/src/runtime.js b/api/src/runtime.js index 6e71837..1658f81 100644 --- a/api/src/runtime.js +++ b/api/src/runtime.js @@ -48,7 +48,7 @@ class Runtime { return res; } - get compile(){ + get compiled(){ if(this.#compiled === undefined) this.#compiled = fss.exists_sync(path.join(this.pkgdir, 'compile')); return this.#compiled; }