drinchev / phook Goto Github PK
View Code? Open in Web Editor NEWruns commands around a parent process ( macOS )
runs commands around a parent process ( macOS )
I was using phook with iTerm2 according to the article written at http://www.drinchev.com/blog/ssh-and-terminal-background/ to set the iTerm2 Profile when ssh'ing into a remote machine.
Since today's MacOS update, when phook executes, it exits immediately without firing the command specified with the '-a' option instead of waiting for the ssh session to end.
An example of usage in ~/.ssh/config is:
Host test
Hostname 192.168.1.2
PermitLocalCommand yes
LocalCommand phook -e 'echo "\033]50;SetProfile=RedProfile\a"' -a 'echo "\033]50;SetProfile=Default\a"'
User testuser
Normally, this would switch iTerm2 to the Profile 'RedProfile' while connected to the 'test' system via ssh, then when ssh exits, the iTerm2 Profile would change to the 'Default' profile. Now, the profile does successfully switch to the Profile 'RedProfile', but does NOT switch back to the 'Default' profile when ssh exits, and I do not see a running 'phook' process while ssh session is running.
Is it likely something in MacOS has broken phook?
phook is helpful to me. Especially for the SSH and terminal background trick.
I would love to see phook as a Homebrew package.
While Homebrew requires some project popularity I added phook to my Homebrew tap:
brew tap thefox/brewery
brew install phook
This will install phook from source.
Suggestion for my ssh use case
In ssh/config i would like to use ProxyCommand with phook.
The kill step would be much simpler if phook could remember the pid of step1 and then somehow just kill/quit it, or i could reference the pid.
phook is a great idea. Consider making it more secure and compliant ...
Why system() is evil and insecure:
http://www.cplusplus.com/forum/articles/11153/
Even CERT warns about its usage:
https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=2130132
I just installed phook
in a new machine and I'm getting this:
$ phook -e 'echo marco' -a 'echo polo'
marco
kevent: No such process
Any idea what's wrong with it?
Fails to install on a clean Ubuntu 16.04.
$ make install
gcc -o phook phook.c
phook.c:12:23: fatal error: sys/event.h: No such file or directory
compilation terminated.
Makefile:4: recipe for target 'phook' failed
make: *** [phook] Error 1
Hi.
Maybe it's intended, but when the connection to the remote host is broken ('client_loop: send disconnect: Broken pipe') the after-script is not executed.
This happens to me regularly when the VPN dies or my internet connection gets reset.
The standard shell.sh fails on Monterrey, the code:
if (ppid == 0)
ppid = getppid();
isn't called.
This is due to ppid
being initialised to something non-zero in:
pid_t ppid, fpid;
I'm not too sure what the value is, they're values like: 217858064, 223969296, etc.
Fortunately the fix is quite simple:
pid_t ppid = 0, fpid;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.