From 187e7dca035814c028a19fe78c845381982f0bd7 Mon Sep 17 00:00:00 2001 From: Wesley Kerfoot Date: Sun, 16 Jun 2019 22:14:03 -0400 Subject: [PATCH] Better bash function --- .gitignore | 1 + README.md | 7 +++++++ server.rkt | 5 ----- shelltalk.sh | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 README.md diff --git a/.gitignore b/.gitignore index 33c11a4..5b76fda 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *pyc *~ venv +server diff --git a/README.md b/README.md new file mode 100644 index 0000000..69c798d --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +### Experimental + +1. Compile `server.rkt` with `raco exe server.rkt` +2. Run `./server` +3. Run `source shelltalk.sh` +4. Execute commands +5. See the history for this shell process with `./client.py -R $$` diff --git a/server.rkt b/server.rkt index c82c4f8..c227ea4 100755 --- a/server.rkt +++ b/server.rkt @@ -33,7 +33,6 @@ ;; Message handling functions (define (write-to entries out) - (displayln entries) (with-handlers ([exn:fail? (const '())]) (write-json entries out) (display "\n" out))) @@ -95,14 +94,10 @@ (handle-connection in out)] [(list "read" pid) - (displayln "got read") (thread-send message-handler (list 'read pid out)) (handle-connection in out)] [(list "write" pid message) - (displayln "got write") - (displayln pid) - (displayln message) (thread-send message-handler (list 'log pid message)) (handle-connection in out)] diff --git a/shelltalk.sh b/shelltalk.sh index e834b8b..5992ebe 100644 --- a/shelltalk.sh +++ b/shelltalk.sh @@ -1,7 +1,7 @@ # Place this in your ~/.bashrc file function log() { - /home/wes/code/shelltalk/client.py -W "$$" "$(history 1)" > /dev/null 2>&1 + /home/wes/code/shelltalk/client.py -W "$$" "$(history 1)" > /dev/null 2>&1 & disown "$!" } /home/wes/code/shelltalk/client.py -S $$