1
0
mirror of https://github.com/sasjs/server.git synced 2025-12-10 19:34:34 +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,
session?: Session
) {
if (process.runTimes.length === 0) {
throw 'No runtime is specified in environment variables.'
}
for (const runTime of process.runTimes) {
const codePath =
path
@@ -58,17 +54,7 @@ export class ExecutionController {
if (await fileExists(codePath)) {
const program = await readFile(codePath)
if (runTime === 'sas') {
return this.executeProgram(
program,
preProgramVariables,
vars,
otherArgs,
returnJson,
session,
runTime
)
} else if (runTime === 'js') {
if (runTime === SASJSRunTimes.JS) {
return this.executeProgram(
program,
preProgramVariables,
@@ -79,7 +65,15 @@ export class ExecutionController {
runTime
)
} else {
throw `${runTime} runtime is not implemented yet.`
return this.executeProgram(
program,
preProgramVariables,
vars,
otherArgs,
returnJson,
session,
runTime
)
}
}
}