io-watch 0.3.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bin/io-watch +36 -11
- data/lib/io/watch/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 197b7721bf73d747ba737369fc907fb390c9d1b76fcf673918476fb25ff31fd5
|
4
|
+
data.tar.gz: 7eb67828008e3680fcc86512b624630b2f3bf26731c1b7e14373ab5719e33609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1100eb530ebc9684d833394c0eda71383a7248959b4b7757ec1587e50a1db0691abe8afcdf2322b4718f95536ab796f59a3ed235d7d4f58ac6120aef68bf4f78
|
7
|
+
data.tar.gz: 3aeb06da9803b9242be48fe66a423578011614423732c5a6f7a90772a19fade4eb471b1efb631043b06f83b70ecc9f1554e47b671d55c0b468a61c3cd8ad1c3c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bin/io-watch
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'console'
|
4
4
|
require 'io/watch'
|
5
5
|
|
6
|
-
root = Dir.pwd
|
7
6
|
command = ARGV
|
8
7
|
pid = nil
|
9
8
|
signal = :INT
|
@@ -12,16 +11,42 @@ if command.first =~ /TERM|INT|KILL|QUIT|HUP/
|
|
12
11
|
signal = command.shift
|
13
12
|
end
|
14
13
|
|
15
|
-
|
14
|
+
if split = command.index('--')
|
15
|
+
roots = command.shift(split)
|
16
|
+
command.shift
|
17
|
+
else
|
18
|
+
roots = [Dir.pwd]
|
19
|
+
end
|
20
|
+
|
21
|
+
Console.debug(self, "Watching", roots: roots, command: command, signal: signal)
|
22
|
+
|
23
|
+
if command.empty?
|
24
|
+
Console.error(self, "No command given")
|
25
|
+
exit 1
|
26
|
+
end
|
27
|
+
|
28
|
+
if roots.empty?
|
29
|
+
Console.error(self, "No roots given")
|
30
|
+
exit 1
|
31
|
+
end
|
32
|
+
|
33
|
+
monitor = IO::Watch::Monitor.new(roots)
|
16
34
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
35
|
+
begin
|
36
|
+
monitor.run do
|
37
|
+
if pid
|
38
|
+
Console.debug(self, "Killing command...", pid: pid)
|
39
|
+
Process.kill(signal, pid)
|
40
|
+
Process.wait(pid)
|
41
|
+
end
|
42
|
+
|
43
|
+
Console.debug(self, "Starting command...")
|
44
|
+
pid = Process.spawn(*command)
|
45
|
+
Console.debug(self, "Started command", pid: pid)
|
22
46
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
47
|
+
rescue Interrupt
|
48
|
+
# Ignore.
|
49
|
+
ensure
|
50
|
+
Process.kill('TERM', pid)
|
51
|
+
Process.wait(pid)
|
27
52
|
end
|
data/lib/io/watch/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|