-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.ts
More file actions
31 lines (23 loc) · 724 Bytes
/
Copy pathbasic.ts
File metadata and controls
31 lines (23 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { TerminalManager } from "@termwright/core";
async function main() {
const manager = TerminalManager;
// Spawn a new terminal session
const session = manager.spawn({
cols: 80,
rows: 24,
cwd: process.cwd(),
});
console.log(`Session created: ${session.id}`);
// Run a simple command
const output = await session.runCommand("echo 'Hello from Termwright!'", {
timeout: 5000,
});
console.log("Command output:", output);
// List files in current directory
const lsOutput = await session.runCommand("ls -la", { timeout: 5000 });
console.log("Directory listing:", lsOutput);
// Clean up
session.destroy();
console.log("Session destroyed");
}
main().catch(console.error);