after 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/ChangeLog +3 -0
  2. data/VERSION +1 -1
  3. data/bin/after +16 -6
  4. data/lib/after.rb +10 -6
  5. metadata +4 -4
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ 0.8.2
2
+ make after -p 1234,4556 possible, cleanup help
3
+
1
4
  0.8.0
2
5
  make prettier output
3
6
  make it so it can enumerate all processes: ($ after -l)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.2
data/bin/after CHANGED
@@ -1,12 +1,22 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
3
  if ARGV.include?('-h') || ARGV.include?('--help') || ARGV.length == 0
4
- puts 'syntax: [-q : quit mode (don\'t show output for when process ends)] [-l or --list : only list matches] [-p pid] "command string to match" (some other command to run with its args on completion)'
5
- puts 'ex: after ruby ls -l # run ls -l after any ruby processes exit'
6
- puts 'after -l # list all running processes'
7
- puts "after irb \"ls | grep l\" # complex command to run after irb terminates"
8
- puts "after -p 3704 ls # run ls after process with PID 3704 terminates"
9
- puts "after -q -p 3704 ls # run ls after PID 3704 terminates, don't output anything except the output of ls"
4
+ puts 'syntax: after [-q] [-l | --list] [-l or --list] [-p pid1 | pid1,pid2,pid3] "command string to match" command to run with args'
5
+ puts ' -q : quiet mode (don\'t show output for when process ends)'
6
+ puts ' --list : only list matches, don\'t actually wait for them'
7
+ puts " \"command string to match\" like ruby.exe or irb : match all processes by name and arguments"
8
+ puts " command to run with args: some other command to run on completion, like ls -l, no quotes needed."
9
+ puts
10
+ puts 'Examples:'
11
+ puts
12
+ puts 'after ruby ls -l # run ls -l after all ruby processes exit'
13
+ puts 'after ruby "ls -l" # same'
14
+ puts 'after -l # list all running processes'
15
+ puts 'after -l ruby # list all running processes that have ruby in their executable name or arguments'
16
+ puts "after irb \"ls | grep l\" # complex command to run after irb terminates (runs $ ls | grep l)"
17
+ puts "after -p 3704 ls # run ls after process with PID 3704 terminates"
18
+ puts "after -q -p 3704 ls # run ls after PID 3704 terminates, don't output anything except the output of ls"
19
+ puts "after -p 3704,4804 ls # run ls after PIDS 3704, 4804 both terminate"
10
20
  exit
11
21
  end
12
22
 
data/lib/after.rb CHANGED
@@ -69,12 +69,16 @@ class After
69
69
  exit # early exit
70
70
  elsif ARGV[0] == '-p'
71
71
  ARGV.shift
72
- pid = ARGV.shift
73
- puts "waiting for pid #{pid}" if $VERBOSE
74
- begin
75
- After.wait_pid pid.to_i
76
- rescue Errno::EPERM
77
- p 'pid does not exist maybe it already had exited ' + pid if $VERBOSE
72
+ pids = ARGV.shift
73
+ pids = pids.split(',')
74
+ puts "waiting for pids #{pids.join(',')}" if $VERBOSE and pids.length > 1
75
+ for pid in pids.split(',')
76
+ puts "waiting for pid #{pid}" if $VERBOSE
77
+ begin
78
+ After.wait_pid pid.to_i
79
+ rescue Errno::EPERM
80
+ p 'pid does not exist maybe it already had exited ' + pid if $VERBOSE
81
+ end
78
82
  end
79
83
  else
80
84
  After.find_and_wait_for(ARGV.shift)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: after
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 1
10
- version: 0.8.1
9
+ - 2
10
+ version: 0.8.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - rogerdpack
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-04 00:00:00 Z
18
+ date: 2011-10-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: sane