Skip to content

Commit

Permalink
Use C4i debug .env file to start service
Browse files Browse the repository at this point in the history
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
  • Loading branch information
sebjulliand committed Dec 13, 2024
1 parent 7106934 commit 54c159d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/api/debug/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { instance } from "../../instantiate";
import { CustomUI } from "../CustomUI";
import IBMi from "../IBMi";
import { Tools } from "../Tools";
import { DebugConfiguration, getDebugServiceDetails } from "./config";
import { DEBUG_CONFIG_FILE, DebugConfiguration, getDebugServiceDetails, ORIGINAL_DEBUG_CONFIG_FILE } from "./config";

export type DebugJob = {
name: string
Expand All @@ -28,6 +28,10 @@ export async function startService(connection: IBMi) {

try {
await checkAuthority();
const debugServiceVersion = (await getDebugServiceDetails()).semanticVersion();
const prestartCommand = (debugServiceVersion.major >= 2 && debugServiceVersion.patch >= 1) ?
`export DEBUG_SERVICE_EXTERNAL_CONFIG_FILE=${DEBUG_CONFIG_FILE}` :
`cp ${DEBUG_CONFIG_FILE} ${ORIGINAL_DEBUG_CONFIG_FILE}`
const debugConfig = await new DebugConfiguration(connection).load();

const submitOptions = await window.showInputBox({
Expand All @@ -41,7 +45,7 @@ export async function startService(connection: IBMi) {
if (submitUser && submitUser !== "*CURRENT") {
await checkAuthority(submitUser);
}
const command = `SBMJOB CMD(STRQSH CMD('${connection.remoteFeatures[`bash`]} -c /QIBM/ProdData/IBMiDebugService/bin/startDebugService.sh')) JOB(DBGSVCE) ${submitOptions}`
const command = `SBMJOB CMD(STRQSH CMD('${connection.remoteFeatures[`bash`]} -c ''${prestartCommand}; /QIBM/ProdData/IBMiDebugService/bin/startDebugService.sh''')) JOB(DBGSVCE) ${submitOptions}`
const submitResult = await connection.runCommand({ command, cwd: debugConfig.getRemoteServiceWorkDir(), noLibList: true });
if (submitResult.code === 0) {
const submitMessage = Tools.parseMessages(submitResult.stderr || submitResult.stdout).findId("CPC1221")?.text;
Expand Down Expand Up @@ -229,7 +233,7 @@ async function openQPRINT(connection: IBMi, job: string) {
.setOptions({ fullWidth: true })
.loadPage(`${job} QPRINT`);
}
else{
else {
window.showWarningMessage(`No QPRINT spooled file found for job ${job}!`);
}
}

0 comments on commit 54c159d

Please sign in to comment.