Skip to content

Commit

Permalink
Fixed terminal initialization flag test
Browse files Browse the repository at this point in the history
Signed-off-by: Seb Julliand <sjulliand@arcadsoftware.com>
  • Loading branch information
sebjulliand committed Dec 2, 2024
1 parent d964d1e commit 8df5d99
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/api/Terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { GlobalConfiguration } from './Configuration';
import IBMi from './IBMi';
import { Tools } from './Tools';

const PASE_INIT_FLAG = '#Code4iInitializationDone';
const PASE_INIT_FLAG = '#C4IINIT';
const PASE_INIT_FLAG_REGEX = /#+C+4+I+I+N+I+T+$/

function getOrDefaultToUndefined(value: string) {
if (value && value !== `default`) {
Expand Down Expand Up @@ -130,7 +131,7 @@ export namespace Terminal {
}

if (!ready) {
ready = dataString.trim().endsWith(PASE_INIT_FLAG);
ready = PASE_INIT_FLAG_REGEX.test(dataString.trim());
}
});

Expand Down Expand Up @@ -175,6 +176,7 @@ export namespace Terminal {
}
},
});
emulatorTerminal.show();
})

if (emulatorTerminal) {
Expand All @@ -200,7 +202,6 @@ export namespace Terminal {
channel.destroy();
});

emulatorTerminal.show();
if (terminalSettings.type === TerminalType._5250) {
channel.write([
`/QOpenSys/pkgs/bin/tn5250`,
Expand All @@ -216,7 +217,7 @@ export namespace Terminal {
initialCommands.push(`cd ${Tools.escapePath(terminalSettings.currentDirectory)}`);
}
initialCommands.push(`echo -e "\\0033[0;32mTerminal started, thanks for using \\0033[0;34mCode for IBM i. \\0033[0;32mCurrent directory is \\0033[0;34m"$(pwd)"\\0033[0m."`);
initialCommands.push(PASE_INIT_FLAG);
initialCommands.push([PASE_INIT_FLAG].join(" "));
channel.write(`${initialCommands.join('; ')}\n`);
}

Expand Down

0 comments on commit 8df5d99

Please sign in to comment.