Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (isCI) {
if (hasStaticOutput) {
this.options.stdout.write(staticOutput);
}
this.lastOutput = output;
return;
}
if (hasStaticOutput) {
this.fullStaticOutput += staticOutput;
}
if (this.options.experimental && outputHeight >= this.options.stdout.rows) {
this.options.stdout.write(
ansiEscapes.clearTerminal + this.fullStaticOutput + output,
);
this.lastOutput = output;
return;
}
// To ensure static output is cleanly rendered before main output, clear main output first
if (hasStaticOutput) {
this.log.clear();
this.options.stdout.write(staticOutput);
}
if (output !== this.lastOutput) {
if (this.options.experimental) {
this.throttledLog(output);
} else {
this.log(output);
if (isCI) {
if (hasStaticOutput) {
this.options.stdout.write(staticOutput);
}
this.lastOutput = output;
return;
}
if (hasStaticOutput) {
this.fullStaticOutput += staticOutput;
}
if (this.options.experimental && outputHeight >= this.options.stdout.rows) {
this.options.stdout.write(ansiEscapes.clearTerminal + this.fullStaticOutput + output);
this.lastOutput = output;
return;
}
// To ensure static output is cleanly rendered before main output, clear main output first
if (hasStaticOutput) {
this.log.clear();
this.options.stdout.write(staticOutput);
}
if (output !== this.lastOutput) {
if (this.options.experimental) {
this.throttledLog(output);
} else {
this.log(output);
}
this.setTimer(async () => {
xtermInstance.instance.write(ansiEscapes.clearTerminal);
if (pathRegEX.test(firstLine)) {
const trimmedLine = firstLine.slice(2, -2).trim();
const prefix = trimmedLine[0] === "/" ? "" : "";
ptyInstance.instance.write(`${prefix} ${trimmedLine} ${this.tmpobj.name}\n`);
} else {
exec('which node', (error, stdout, stderr) => {
if (error) alert(`exec error: ${error}`);
else ptyInstance.instance.write(`${stdout.slice(0, stdout.length - 1)} ${this.tmpobj.name}\n`);
});
}
})
function print(str, hide=true) {
console.log(esc.clearTerminal)
console.log(str);
console.log(hide ? esc.cursorHide : esc.cursorShow);
}
replayUid(uid, cols) {
if (uid in this.records && Number.isInteger(this.index)) {
let data = this.records[uid][this.index]
data = data.replace(/^.*$/mg, line => cliTruncate(expandTabs(line), cols))
data = ansiEscapes.clearTerminal + data
this.store.dispatch({
type: 'SESSION_PTY_DATA',
uid,
data
})
}
}
private clear(): void {
this.print(ansiEscapes.clearTerminal);
}