mirror of
https://github.com/sasjs/server.git
synced 2025-12-10 19:34:34 +00:00
fix(execute): fixed adding print output
This commit is contained in:
@@ -62,7 +62,8 @@ const executeCode = async (
|
||||
preProgramVariables: getPreProgramVariables(req),
|
||||
vars: { ...req.query, _debug: 131 },
|
||||
otherArgs: { userAutoExec },
|
||||
runTime: runTime
|
||||
runTime: runTime,
|
||||
addPrintOutput: true
|
||||
})
|
||||
|
||||
return result
|
||||
|
||||
@@ -29,7 +29,7 @@ interface ExecuteFileParams {
|
||||
session?: Session
|
||||
runTime: RunTimeType
|
||||
forceStringResult?: boolean
|
||||
isStp?: boolean
|
||||
addPrintOutput?: boolean
|
||||
}
|
||||
|
||||
interface ExecuteProgramParams extends Omit<ExecuteFileParams, 'programPath'> {
|
||||
@@ -45,8 +45,7 @@ export class ExecutionController {
|
||||
returnJson,
|
||||
session,
|
||||
runTime,
|
||||
forceStringResult,
|
||||
isStp
|
||||
forceStringResult
|
||||
}: ExecuteFileParams) {
|
||||
const program = await readFile(programPath)
|
||||
|
||||
@@ -58,8 +57,7 @@ export class ExecutionController {
|
||||
returnJson,
|
||||
session,
|
||||
runTime,
|
||||
forceStringResult,
|
||||
isStp
|
||||
forceStringResult
|
||||
})
|
||||
}
|
||||
|
||||
@@ -71,7 +69,7 @@ export class ExecutionController {
|
||||
session: sessionByFileUpload,
|
||||
runTime,
|
||||
forceStringResult,
|
||||
isStp
|
||||
addPrintOutput
|
||||
}: ExecuteProgramParams): Promise<ExecuteReturnRaw> {
|
||||
const sessionController = getSessionController(runTime)
|
||||
|
||||
@@ -133,7 +131,7 @@ export class ExecutionController {
|
||||
resultParts.push(process.logsUUID)
|
||||
resultParts.push(log)
|
||||
|
||||
if (!isStp) {
|
||||
if (addPrintOutput && runTime === RunTimeType.SAS) {
|
||||
const printOutputPath = path.join(session.path, 'output.lst')
|
||||
const printOutput = (await fileExists(printOutputPath))
|
||||
? await readFile(printOutputPath)
|
||||
|
||||
@@ -74,8 +74,7 @@ const execute = async (
|
||||
req: express.Request,
|
||||
_program: string,
|
||||
vars: ExecutionVars,
|
||||
otherArgs?: any,
|
||||
isStp?: boolean
|
||||
otherArgs?: any
|
||||
): Promise<string | Buffer> => {
|
||||
try {
|
||||
const { codePath, runTime } = await getRunTimeAndFilePath(_program)
|
||||
@@ -87,8 +86,7 @@ const execute = async (
|
||||
preProgramVariables: getPreProgramVariables(req),
|
||||
vars,
|
||||
otherArgs,
|
||||
session: req.sasjsSession,
|
||||
isStp
|
||||
session: req.sasjsSession
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user