Update example.js to add multiple terminal inputs and extend timeout duration. Modify stat-vit-term.js to adjust shell arguments for improved compatibility.

This commit is contained in:
sebseb7
2025-08-12 00:49:12 +02:00
parent e1887980d4
commit 2c83d402fc
2 changed files with 7 additions and 2 deletions

View File

@@ -26,11 +26,16 @@ termSession.on('ready', () => {
setTimeout(() => { setTimeout(() => {
console.log('\n--- Ping abbrechen mit ^C ---'); console.log('\n--- Ping abbrechen mit ^C ---');
termSession.input('^C'); termSession.input('^C');
termSession.input("sdfsdfsdaf\n");
termSession.input("\n");
termSession.input("\n");
termSession.input("\n");
}, 3000); }, 3000);
// Nach 4 Sekunden beenden // Nach 4 Sekunden beenden
setTimeout(() => { setTimeout(() => {
console.log('\n--- Terminal beenden ---'); console.log('\n--- Terminal beenden ---');
termSession.kill(); termSession.kill();
}, 4000); }, 40000000);
}); });

View File

@@ -24,7 +24,7 @@ class StatVitTerm extends EventEmitter {
_init() { _init() {
try { try {
// Wichtige Änderung: Shell im richtigen Modus starten // Wichtige Änderung: Shell im richtigen Modus starten
const args = process.platform === 'win32' ? [] : ['-i', '-l']; // login shell const args = process.platform === 'win32' ? [] : ['-l']; // login shell
this.process = spawn(this.options.shell, args, { this.process = spawn(this.options.shell, args, {
stdio: ['pipe', 'pipe', 'pipe'], stdio: ['pipe', 'pipe', 'pipe'],
cwd: this.options.cwd, cwd: this.options.cwd,