Crates.io | tauri-plugin-pty |
lib.rs | tauri-plugin-pty |
version | 0.0.8 |
source | src |
created_at | 2023-12-19 16:34:31.214708 |
updated_at | 2023-12-24 16:36:32.724949 |
description | Pseudo Terminal (PTY) plugin for Tauri |
homepage | |
repository | |
max_upload_size | |
id | 1074468 |
size | 88,502 |
Developing! Wellcome to contribute!
Full example at: https://github.com/Tnze/tauri-plugin-pty/tree/main/examples/vanilla
# Install this plugin in your Cargo.toml
cargo add tauri-plugin-pty
# Install the api package
npm install tauri-pty
tauri::Builder::default()
.plugin(tauri_plugin_pty::init()) // add this
.run(tauri::generate_context!())
.expect("error while running tauri application");
...
import { Terminal } from "xterm"
import { spawn } from "tauri-pty";
// init xterm.js
const term = new Terminal();
term.open(/* DOM Elem */);
// spawn shell
const pty = spawn("powershell.exe", [/* args */], {
cols: term.cols,
rows: term.rows,
})
// transport data
pty.onData(data => term.write(data))
term.onData(data => pty.write(data))