sesh 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sesh/cli.rb +0 -1
- data/lib/sesh/tmux_control.rb +19 -7
- data/lib/sesh/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74b3f87282f5252856e6cd89895a40144e9f0ea3
|
4
|
+
data.tar.gz: 14c8da3d3a2e8ca8ae0719818ea839ff2393f6cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 358f35e691af07194d7759c90791fff24810f0ebae616b0450f01191bd9421efd4d34517ed79a2c69d8b95d8b8fd85dc04dada85ccde28cc5493fa48f8d5dea4
|
7
|
+
data.tar.gz: c730cb2453dc3225f834507b9c2e13bb2c740833af18f393965738175b909948c16e3170c7029480bbf1bf44b88c26d63fe10a843f86758c0a75d11e7fb4d29a
|
data/Gemfile.lock
CHANGED
data/lib/sesh/cli.rb
CHANGED
data/lib/sesh/tmux_control.rb
CHANGED
@@ -34,12 +34,21 @@ module Sesh
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def issue_stop_command!;
|
37
|
-
`
|
37
|
+
`ps -ef | grep "[t]mux -u attach-session -t #{Regexp.escape(@project)}\\$" | grep -v grep | awk '{print $2}' | xargs kill -9`
|
38
|
+
end
|
38
39
|
|
39
40
|
def connection_command; "tmux -S #{@options[:socket_file]} a" end
|
40
41
|
|
41
42
|
def obtain_pids_from_session
|
42
|
-
|
43
|
+
tmux_processes =
|
44
|
+
`tmux list-panes -s -F "\#{pane_pid} \#{pane_current_command}" -t "#{@project}" 2> /dev/null | grep -v tmux | awk '{print $1}'`.strip.lines +
|
45
|
+
`tmux -S "#{@options[:socket_file]}" list-panes -s -F "\#{pane_pid} \#{pane_current_command}" 2> /dev/null | grep -v tmux | awk '{print $1}'`.strip.lines
|
46
|
+
return [] unless tmux_processes.any?
|
47
|
+
spring_processes = []
|
48
|
+
spring_app_pid = `ps -ef | grep "[s]pring app .*| #{@project} |" | grep -v grep | awk '{print $2}'`.strip
|
49
|
+
spring_processes += `ps -ef | grep #{spring_app_pid} | grep -v grep | grep -v "[s]pring app" | awk '{print $2}'`.strip.lines if spring_app_pid.length > 0
|
50
|
+
spring_processes += `ps -ef | grep "[s]pring.*| #{@project} |" | grep -v grep | awk '{print $2}'`.strip.lines
|
51
|
+
spring_processes + tmux_processes
|
43
52
|
end
|
44
53
|
def store_pids_from_session!
|
45
54
|
File.open(@options[:pids_file], 'w') {|f|
|
@@ -47,12 +56,15 @@ module Sesh
|
|
47
56
|
end
|
48
57
|
|
49
58
|
def kill_running_processes
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
59
|
+
obtain_pids_from_session.each{|pid| kill_process! pid }
|
60
|
+
# if File.exists? @options[:pids_file]
|
61
|
+
# File.readlines(@options[:pids_file]).each{|pid|
|
62
|
+
# puts "Killing #{pid}"
|
63
|
+
# kill_process! pid }
|
64
|
+
# File.delete @options[:pids_file]
|
65
|
+
# end
|
54
66
|
end
|
55
|
-
def kill_process!(pid); `kill -9 #{pid}` end
|
67
|
+
def kill_process!(pid); `kill -9 #{pid} 2>&1` end
|
56
68
|
|
57
69
|
def begin_tmuxinator_session!
|
58
70
|
%x[env TMUX='' mux start #{@project}] end
|
data/lib/sesh/version.rb
CHANGED