childprocess 0.8.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. data/.document +6 -6
  3. data/.gitignore +28 -28
  4. data/.rspec +1 -1
  5. data/.travis.yml +42 -36
  6. data/CHANGELOG.md +67 -44
  7. data/Gemfile +18 -15
  8. data/LICENSE +20 -20
  9. data/README.md +216 -192
  10. data/Rakefile +61 -61
  11. data/appveyor.yml +42 -43
  12. data/childprocess.gemspec +32 -30
  13. data/ext/mkrf_conf.rb +24 -0
  14. data/lib/childprocess/abstract_io.rb +36 -36
  15. data/lib/childprocess/abstract_process.rb +192 -192
  16. data/lib/childprocess/errors.rb +37 -26
  17. data/lib/childprocess/jruby/io.rb +16 -16
  18. data/lib/childprocess/jruby/process.rb +184 -159
  19. data/lib/childprocess/jruby/pump.rb +53 -53
  20. data/lib/childprocess/jruby.rb +56 -56
  21. data/lib/childprocess/tools/generator.rb +145 -145
  22. data/lib/childprocess/unix/fork_exec_process.rb +78 -70
  23. data/lib/childprocess/unix/io.rb +21 -21
  24. data/lib/childprocess/unix/lib.rb +186 -186
  25. data/lib/childprocess/unix/platform/i386-linux.rb +12 -12
  26. data/lib/childprocess/unix/platform/i386-solaris.rb +11 -11
  27. data/lib/childprocess/unix/platform/x86_64-linux.rb +12 -12
  28. data/lib/childprocess/unix/platform/x86_64-macosx.rb +11 -11
  29. data/lib/childprocess/unix/posix_spawn_process.rb +134 -134
  30. data/lib/childprocess/unix/process.rb +90 -89
  31. data/lib/childprocess/unix.rb +9 -9
  32. data/lib/childprocess/version.rb +3 -3
  33. data/lib/childprocess/windows/handle.rb +91 -91
  34. data/lib/childprocess/windows/io.rb +25 -25
  35. data/lib/childprocess/windows/lib.rb +416 -416
  36. data/lib/childprocess/windows/process.rb +130 -130
  37. data/lib/childprocess/windows/process_builder.rb +178 -175
  38. data/lib/childprocess/windows/structs.rb +148 -148
  39. data/lib/childprocess/windows.rb +33 -33
  40. data/lib/childprocess.rb +210 -205
  41. data/spec/abstract_io_spec.rb +12 -12
  42. data/spec/childprocess_spec.rb +447 -391
  43. data/spec/get_env.ps1 +13 -0
  44. data/spec/io_spec.rb +228 -228
  45. data/spec/jruby_spec.rb +24 -24
  46. data/spec/pid_behavior.rb +12 -12
  47. data/spec/platform_detection_spec.rb +86 -86
  48. data/spec/spec_helper.rb +270 -261
  49. data/spec/unix_spec.rb +57 -57
  50. data/spec/windows_spec.rb +23 -23
  51. metadata +18 -33
@@ -1,86 +1,86 @@
1
- require File.expand_path('../spec_helper', __FILE__)
2
-
3
- # Q: Should platform detection concern be extracted from ChildProcess?
4
- describe ChildProcess do
5
-
6
- describe ".arch" do
7
- subject { described_class.arch }
8
-
9
- before(:each) { described_class.instance_variable_set(:@arch, nil) }
10
-
11
- after(:each) { described_class.instance_variable_set(:@arch, nil) }
12
-
13
- shared_examples 'expected_arch_for_host_cpu' do |host_cpu, expected_arch|
14
- context "when host_cpu is '#{host_cpu}'" do
15
- before :each do
16
- allow(RbConfig::CONFIG).
17
- to receive(:[]).
18
- with('host_cpu').
19
- and_return(expected_arch)
20
- end
21
-
22
- it { is_expected.to eq expected_arch }
23
- end
24
- end
25
-
26
- # Normal cases: not macosx - depends only on host_cpu
27
- context "when os is *not* 'macosx'" do
28
- before :each do
29
- allow(described_class).to receive(:os).and_return(:not_macosx)
30
- end
31
-
32
- [
33
- { host_cpu: 'i386', expected_arch: 'i386' },
34
- { host_cpu: 'i486', expected_arch: 'i386' },
35
- { host_cpu: 'i586', expected_arch: 'i386' },
36
- { host_cpu: 'i686', expected_arch: 'i386' },
37
- { host_cpu: 'amd64', expected_arch: 'x86_64' },
38
- { host_cpu: 'x86_64', expected_arch: 'x86_64' },
39
- { host_cpu: 'ppc', expected_arch: 'powerpc' },
40
- { host_cpu: 'powerpc', expected_arch: 'powerpc' },
41
- { host_cpu: 'unknown', expected_arch: 'unknown' },
42
- ].each do |args|
43
- include_context 'expected_arch_for_host_cpu', args.values
44
- end
45
- end
46
-
47
- # Special cases: macosx - when host_cpu is i686, have to re-check
48
- context "when os is 'macosx'" do
49
- before :each do
50
- allow(described_class).to receive(:os).and_return(:macosx)
51
- end
52
-
53
- context "when host_cpu is 'i686' " do
54
- shared_examples 'expected_arch_on_macosx_i686' do |is_64, expected_arch|
55
- context "when Ruby is #{is_64 ? 64 : 32}-bit" do
56
- before :each do
57
- allow(described_class).
58
- to receive(:is_64_bit?).
59
- and_return(is_64)
60
- end
61
-
62
- include_context 'expected_arch_for_host_cpu', 'i686', expected_arch
63
- end
64
- end
65
-
66
- [
67
- { is_64: true, expected_arch: 'x86_64' },
68
- { is_64: false, expected_arch: 'i386' }
69
- ].each do |args|
70
- include_context 'expected_arch_on_macosx_i686', args.values
71
- end
72
- end
73
-
74
- [
75
- { host_cpu: 'amd64', expected_arch: 'x86_64' },
76
- { host_cpu: 'x86_64', expected_arch: 'x86_64' },
77
- { host_cpu: 'ppc', expected_arch: 'powerpc' },
78
- { host_cpu: 'powerpc', expected_arch: 'powerpc' },
79
- { host_cpu: 'unknown', expected_arch: 'unknown' },
80
- ].each do |args|
81
- include_context 'expected_arch_for_host_cpu', args.values
82
- end
83
- end
84
- end
85
-
86
- end
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ # Q: Should platform detection concern be extracted from ChildProcess?
4
+ describe ChildProcess do
5
+
6
+ describe ".arch" do
7
+ subject { described_class.arch }
8
+
9
+ before(:each) { described_class.instance_variable_set(:@arch, nil) }
10
+
11
+ after(:each) { described_class.instance_variable_set(:@arch, nil) }
12
+
13
+ shared_examples 'expected_arch_for_host_cpu' do |host_cpu, expected_arch|
14
+ context "when host_cpu is '#{host_cpu}'" do
15
+ before :each do
16
+ allow(RbConfig::CONFIG).
17
+ to receive(:[]).
18
+ with('host_cpu').
19
+ and_return(expected_arch)
20
+ end
21
+
22
+ it { is_expected.to eq expected_arch }
23
+ end
24
+ end
25
+
26
+ # Normal cases: not macosx - depends only on host_cpu
27
+ context "when os is *not* 'macosx'" do
28
+ before :each do
29
+ allow(described_class).to receive(:os).and_return(:not_macosx)
30
+ end
31
+
32
+ [
33
+ { host_cpu: 'i386', expected_arch: 'i386' },
34
+ { host_cpu: 'i486', expected_arch: 'i386' },
35
+ { host_cpu: 'i586', expected_arch: 'i386' },
36
+ { host_cpu: 'i686', expected_arch: 'i386' },
37
+ { host_cpu: 'amd64', expected_arch: 'x86_64' },
38
+ { host_cpu: 'x86_64', expected_arch: 'x86_64' },
39
+ { host_cpu: 'ppc', expected_arch: 'powerpc' },
40
+ { host_cpu: 'powerpc', expected_arch: 'powerpc' },
41
+ { host_cpu: 'unknown', expected_arch: 'unknown' },
42
+ ].each do |args|
43
+ include_context 'expected_arch_for_host_cpu', args.values
44
+ end
45
+ end
46
+
47
+ # Special cases: macosx - when host_cpu is i686, have to re-check
48
+ context "when os is 'macosx'" do
49
+ before :each do
50
+ allow(described_class).to receive(:os).and_return(:macosx)
51
+ end
52
+
53
+ context "when host_cpu is 'i686' " do
54
+ shared_examples 'expected_arch_on_macosx_i686' do |is_64, expected_arch|
55
+ context "when Ruby is #{is_64 ? 64 : 32}-bit" do
56
+ before :each do
57
+ allow(described_class).
58
+ to receive(:is_64_bit?).
59
+ and_return(is_64)
60
+ end
61
+
62
+ include_context 'expected_arch_for_host_cpu', 'i686', expected_arch
63
+ end
64
+ end
65
+
66
+ [
67
+ { is_64: true, expected_arch: 'x86_64' },
68
+ { is_64: false, expected_arch: 'i386' }
69
+ ].each do |args|
70
+ include_context 'expected_arch_on_macosx_i686', args.values
71
+ end
72
+ end
73
+
74
+ [
75
+ { host_cpu: 'amd64', expected_arch: 'x86_64' },
76
+ { host_cpu: 'x86_64', expected_arch: 'x86_64' },
77
+ { host_cpu: 'ppc', expected_arch: 'powerpc' },
78
+ { host_cpu: 'powerpc', expected_arch: 'powerpc' },
79
+ { host_cpu: 'unknown', expected_arch: 'unknown' },
80
+ ].each do |args|
81
+ include_context 'expected_arch_for_host_cpu', args.values
82
+ end
83
+ end
84
+ end
85
+
86
+ end