Crates.io | termrun |
lib.rs | termrun |
version | 0.1.0 |
source | src |
created_at | 2021-06-06 16:57:13.654491 |
updated_at | 2021-06-06 16:57:13.654491 |
description | Send & run commands on other open Unix terminals |
homepage | https://github.com/mdaverde/termrun |
repository | https://github.com/mdaverde/termrun |
max_upload_size | |
id | 406941 |
size | 20,999 |
$ termrun [--newline] [--all|--pty /dev/pty/N] cmd
Note: Requires sudo
each time unless root is set as owner. See Privileges section below
Open terminal 1:
$ tty
/dev/pts/2
Open terminal 2:
$ termrun --newline --pty /dev/pts/2 echo hello world
--newline
appends \n
to the sent command to actually run
Displayed in open terminal 1:
$ tty
/dev/pts/2
$ echo hello world
hello world
$ vim ~/.zshrc # make config changes
$ termrun --newline --all source ~/.zshrc
If you're using a recent version of Cargo, you can see the cargo install
command:
$ cargo install termrun
After git cloning this repo, you can install as a cargo crate through
$ cargo install --path path/to/repo
This should make termrun
available everywhere assuming your cargo crates are in $PATH
termrun
uses ioctl(2)
under the hood through the TIOCSTI cmd flag. To do this successfully, the process needs root user privileges to run.
In practice, this means having to run termrun
with sudo
. By default when you install global crates, sudo doesn't know about them:
$ termrun
Error: EPERM: Operation not permitted
$ sudo termrun
[sudo] password for user:
sudo: termrun: command not found
The solutions here are to:
termrun
into a sudo
-friendly path: sudo ln -s ~/.cargo/bin/termrun /usr/local/bin/
sudo
can find termrun
: sudo ~/.cargo/bin/termrun
sudo
to use your $PATH
: sudo env "PATH=$PATH" termrun
MIT - Maintained by Milan