Get rid of file language logic

This commit is contained in:
Omar Brikaa 2022-02-25 18:07:46 +02:00
parent 961b678948
commit 89f4da4858
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(body) {
}); });
} }
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

@ -81,10 +81,7 @@ function get_job(body) {
}); });
} }
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');