process_starter 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/process_starter.rb +4 -4
  2. metadata +6 -6
@@ -11,7 +11,6 @@ module ProcessStarter
11
11
  WINRUN = (RUBY_PLATFORM =~ /mswin|mingw/) ? true : false # run in windows?
12
12
  HAVE_SPAWN = defined?(spawn) ? true : false # have Ruby 1.9 spawn method
13
13
  HAVE_POSIX_SPAWN = defined?(POSIX::Spawn::spawn) ? true : false # loaded posix/spawn lib
14
- HAVE_PSEXEC = WINRUN ? ((`psexec /?` rescue "") =~ /computer/ ? true : false) : false
15
14
 
16
15
  def self.log(m)
17
16
  defined?(RAILS_DEFAULT_LOGGER) ? RAILS_DEFAULT_LOGGER.info(m) : puts(m)
@@ -22,9 +21,10 @@ module ProcessStarter
22
21
  # not inheritting file descriptors, so it finds and closes all opened handels
23
22
  # works in windows and linux
24
23
  def self.start(s)
25
- log "**************** INVOKING EXTERNAL COMMAND #{s}, WINRUN IS #{WINRUN}, HAVE_PSEXEC IS #{HAVE_PSEXEC}, HAVE_POSIX_SPAWN IS #{HAVE_POSIX_SPAWN}, HAVE_SPAWN is #{HAVE_SPAWN}"
24
+ log "********* ProcessStarter.start INVOKING EXTERNAL COMMAND #{s}, WINRUN IS #{WINRUN}, HAVE_POSIX_SPAWN IS #{HAVE_POSIX_SPAWN}, HAVE_SPAWN is #{HAVE_SPAWN}"
26
25
  if WINRUN
27
- if HAVE_PSEXEC
26
+ @@have_psexec ||= ((`psexec /?` rescue "") =~ /computer/ ? 2 : 1)
27
+ if @@have_psexec == 2
28
28
  log "starting using psexec"
29
29
  r = system("psexec -d #{s}")
30
30
  else
@@ -82,7 +82,7 @@ module ProcessStarter
82
82
  next if io.fileno < 3
83
83
  puts "checking flag" if debug
84
84
  r = begin; io.fcntl(Fcntl::F_GETFD) & Fcntl::FD_CLOEXEC != 0 rescue false; end
85
- puts r
85
+ puts if debug
86
86
  # puts io.fcntl(Fcntl::F_GETFD) & Fcntl::FD_CLOEXEC
87
87
  # next if (io.fcntl(Fcntl::F_GETFD) & Fcntl::FD_CLOEXEC != 0)
88
88
  next if r
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_starter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pavel Vasev
@@ -15,11 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-23 00:00:00 +06:00
18
+ date: 2012-09-24 00:00:00 +06:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
22
- description: A gem to start process in parallel plus dont inherit handles plus both in windows/linux plus learn me to make gems
22
+ description: A gem to start process in parallel plus dont inherit handles plus both in windows/linux
23
23
  email: pavel.vasev@gmail.com
24
24
  executables: []
25
25
 
@@ -65,6 +65,6 @@ rubyforge_project:
65
65
  rubygems_version: 1.5.2
66
66
  signing_key:
67
67
  specification_version: 3
68
- summary: Process Starter / not inherit file descriptors
68
+ summary: Process Starter / spawn proces in ruby 1.8 in parralel and dont inherit file descriptors
69
69
  test_files: []
70
70