Merge pull request #451 from Brikaa/get-rid-of-file-language

Get rid of file language logic, remove unneeded requires
This commit is contained in:
Thomas Hobson 2022-02-26 10:15:07 +13:00 committed by GitHub
commit 067cf2692f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 16 deletions

View File

@ -3,7 +3,6 @@ const router = express.Router();
const events = require('events'); const events = require('events');
const runtime = require('../runtime');
const { Job } = require('../job'); const { Job } = require('../job');
const SIGNALS = [ const SIGNALS = [
@ -90,10 +89,7 @@ function get_job(job_info, available_runtimes) {
}); });
} }
if ( if (!files.some(file => !file.encoding || file.encoding === 'utf8')) {
rt.language !== 'file' &&
!files.some(file => !file.encoding || file.encoding === 'utf8')
) {
return reject({ return reject({
message: 'files must include at least one utf8 encoded file', message: 'files must include at least one utf8 encoded file',
}); });

View File

@ -80,10 +80,7 @@ function get_job(job_info, available_runtimes) {
}); });
} }
if ( if (!files.some(file => !file.encoding || file.encoding === 'utf8')) {
rt.language !== 'file' &&
!files.some(file => !file.encoding || file.encoding === 'utf8')
) {
return reject({ return reject({
message: 'files must include at least one utf8 encoded file', message: 'files must include at least one utf8 encoded file',
}); });

View File

@ -1,5 +1,4 @@
const logplease = require('logplease'); const logplease = require('logplease');
const logger = logplease.create('job');
const { v4: uuidv4 } = require('uuid'); const { v4: uuidv4 } = require('uuid');
const cp = require('child_process'); const cp = require('child_process');
const path = require('path'); const path = require('path');
@ -226,9 +225,7 @@ class Job {
this.logger.info(`Executing job runtime=${this.runtime.toString()}`); this.logger.info(`Executing job runtime=${this.runtime.toString()}`);
const code_files = const code_files = this.files.filter(file => file.encoding == 'utf8');
(this.runtime.language === 'file' && this.files) ||
this.files.filter(file => file.encoding == 'utf8');
this.logger.debug('Compiling'); this.logger.debug('Compiling');
@ -274,9 +271,7 @@ class Job {
`Interactively executing job runtime=${this.runtime.toString()}` `Interactively executing job runtime=${this.runtime.toString()}`
); );
const code_files = const code_files = this.files.filter(file => file.encoding == 'utf8');
(this.runtime.language === 'file' && this.files) ||
this.files.filter(file => file.encoding == 'utf8');
if (this.runtime.compiled) { if (this.runtime.compiled) {
eventBus.emit('stage', 'compile'); eventBus.emit('stage', 'compile');