1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-11 03:34:35 +00:00

fix: refactor code in executeFile method of session controller

This commit is contained in:
2022-06-06 15:23:42 +05:00
parent b4443819d4
commit dffe6d7121

View File

@@ -44,10 +44,6 @@ export class ExecutionController {
returnJson?: boolean, returnJson?: boolean,
session?: Session session?: Session
) { ) {
if (process.runTimes.length === 0) {
throw 'No runtime is specified in environment variables.'
}
for (const runTime of process.runTimes) { for (const runTime of process.runTimes) {
const codePath = const codePath =
path path
@@ -58,17 +54,7 @@ export class ExecutionController {
if (await fileExists(codePath)) { if (await fileExists(codePath)) {
const program = await readFile(codePath) const program = await readFile(codePath)
if (runTime === 'sas') { if (runTime === SASJSRunTimes.JS) {
return this.executeProgram(
program,
preProgramVariables,
vars,
otherArgs,
returnJson,
session,
runTime
)
} else if (runTime === 'js') {
return this.executeProgram( return this.executeProgram(
program, program,
preProgramVariables, preProgramVariables,
@@ -79,7 +65,15 @@ export class ExecutionController {
runTime runTime
) )
} else { } else {
throw `${runTime} runtime is not implemented yet.` return this.executeProgram(
program,
preProgramVariables,
vars,
otherArgs,
returnJson,
session,
runTime
)
} }
} }
} }