Only compile/run files in utf8 encoding

This commit is contained in:
Thomas Hobson 2021-10-14 01:36:29 +13:00
parent 24a352699d
commit 0faea205db
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
1 changed files with 8 additions and 4 deletions

View File

@ -222,6 +222,8 @@ class Job {
} runtime=${this.runtime.toString()}`
);
const code_files = this.files.filter(file => file.encoding == 'utf8');
logger.debug('Compiling');
let compile;
@ -229,7 +231,7 @@ class Job {
if (this.runtime.compiled) {
compile = await this.safe_call(
path.join(this.runtime.pkgdir, 'compile'),
this.files.map(x => x.name),
code_files.map(x => x.name),
this.timeouts.compile,
this.memory_limits.compile
);
@ -239,7 +241,7 @@ class Job {
const run = await this.safe_call(
path.join(this.runtime.pkgdir, 'run'),
[this.files[0].name, ...this.args],
[code_files[0].name, ...this.args],
this.timeouts.run,
this.memory_limits.run
);
@ -268,11 +270,13 @@ class Job {
} gid=${this.gid} runtime=${this.runtime.toString()}`
);
const code_files = this.files.filter(file => file.encoding == 'utf8');
if (this.runtime.compiled) {
eventBus.emit('stage', 'compile');
const { error, code, signal } = await this.safe_call(
path.join(this.runtime.pkgdir, 'compile'),
this.files.map(x => x.name),
code_files.map(x => x.name),
this.timeouts.compile,
this.memory_limits.compile,
eventBus
@ -285,7 +289,7 @@ class Job {
eventBus.emit('stage', 'run');
const { error, code, signal } = await this.safe_call(
path.join(this.runtime.pkgdir, 'run'),
[this.files[0].name, ...this.args],
[code_files[0].name, ...this.args],
this.timeouts.run,
this.memory_limits.run,
eventBus