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