aruba 0.10.2 → 0.11.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +6 -5
- data/Gemfile +0 -4
- data/History.md +17 -1
- data/features/api/command/run.feature +101 -1
- data/features/api/command/send_signal.feature +53 -0
- data/features/api/command/stop.feature +79 -0
- data/features/api/text/replace_variables.feature +45 -0
- data/features/configuration/startup_wait_time.feature +48 -0
- data/features/step_definitions/hooks.rb +85 -6
- data/features/steps/{commands → command}/exit_statuses.feature +0 -0
- data/features/steps/{commands → command}/in_process.feature +174 -0
- data/features/steps/{commands → command}/run.feature +1 -0
- data/features/steps/command/send_signal.feature +104 -0
- data/features/steps/command/stop.feature +313 -0
- data/features/steps/overview.feature +60 -0
- data/lib/aruba/announcer.rb +2 -0
- data/lib/aruba/api/command.rb +24 -9
- data/lib/aruba/api/text.rb +9 -0
- data/lib/aruba/command.rb +4 -1
- data/lib/aruba/config.rb +2 -0
- data/lib/aruba/cucumber/command.rb +75 -0
- data/lib/aruba/cucumber/core.rb +0 -24
- data/lib/aruba/cucumber/hooks.rb +10 -0
- data/lib/aruba/errors.rb +3 -0
- data/lib/aruba/matchers/command/have_output.rb +1 -1
- data/lib/aruba/process_monitor.rb +25 -1
- data/lib/aruba/processes/basic_process.rb +22 -2
- data/lib/aruba/processes/debug_process.rb +7 -1
- data/lib/aruba/processes/in_process.rb +15 -1
- data/lib/aruba/processes/null_process.rb +26 -0
- data/lib/aruba/processes/spawn_process.rb +81 -48
- data/lib/aruba/rspec.rb +6 -0
- data/lib/aruba/version.rb +1 -1
- metadata +26 -11
File without changes
|
@@ -34,6 +34,8 @@ Feature: Run commands in ruby process
|
|
34
34
|
and not during "loadtime", when the `ruby`-interpreter reads in you class
|
35
35
|
files.
|
36
36
|
|
37
|
+
**WARNING**: Using `:in_process` interactively is not supported
|
38
|
+
|
37
39
|
Background:
|
38
40
|
Given I use a fixture named "cli-app"
|
39
41
|
And a file named "features/support/cli_app.rb" with:
|
@@ -298,3 +300,175 @@ Feature: Run commands in ruby process
|
|
298
300
|
"""
|
299
301
|
When I run `cucumber`
|
300
302
|
Then the features should all pass
|
303
|
+
|
304
|
+
Scenario: Use $stderr, $stdout and $stdin to access IO
|
305
|
+
|
306
|
+
May may need/want to use the default `STDERR`, `STDOUT`, `STDIN`-constants
|
307
|
+
to access IO from within your script. Unfortunately this does not work with
|
308
|
+
the `:in_process`-command launcher. You need to use `$stderr`, `$stdout`
|
309
|
+
and `$stdin` instead.
|
310
|
+
|
311
|
+
For this example I chose `thor` to parse ARGV. Its `.start`-method accepts
|
312
|
+
an "Array" as ARGV and a "Hash" for some other options – `.start <ARGV>, <OPTIONS>`
|
313
|
+
|
314
|
+
Given a file named "lib/cli/app/runner.rb" with:
|
315
|
+
"""
|
316
|
+
require 'cli/app/cli_parser'
|
317
|
+
|
318
|
+
module Cli
|
319
|
+
module App
|
320
|
+
class Runner
|
321
|
+
def initialize(argv, stdin, stdout, stderr, kernel)
|
322
|
+
@argv = argv
|
323
|
+
$kernel = kernel
|
324
|
+
$stdin = stdin
|
325
|
+
$stdout = stdout
|
326
|
+
$stderr = stderr
|
327
|
+
end
|
328
|
+
|
329
|
+
def execute!
|
330
|
+
Cli::App::CliParser.start @argv
|
331
|
+
end
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
335
|
+
"""
|
336
|
+
And a file named "lib/cli/app/cli_parser.rb" with:
|
337
|
+
"""
|
338
|
+
require 'thor'
|
339
|
+
|
340
|
+
module Cli
|
341
|
+
module App
|
342
|
+
class CliParser < Thor
|
343
|
+
def self.exit_on_failure?
|
344
|
+
true
|
345
|
+
end
|
346
|
+
|
347
|
+
desc 'do_it', 'Reverse input'
|
348
|
+
def do_it(*args)
|
349
|
+
$stderr.puts 'Hey ya, Hey ya, check, check, check'
|
350
|
+
$stdout.puts(args.flatten.map(&:reverse).join(' '))
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
355
|
+
"""
|
356
|
+
And a file named "features/in_process.feature" with:
|
357
|
+
"""
|
358
|
+
Feature: Run a command in process
|
359
|
+
@in-process
|
360
|
+
Scenario: Run command
|
361
|
+
When I run `reverse.rb do_it Hello World`
|
362
|
+
Then the stdout should contain:
|
363
|
+
\"\"\"
|
364
|
+
olleH dlroW
|
365
|
+
\"\"\"
|
366
|
+
And the stderr should contain:
|
367
|
+
\"\"\"
|
368
|
+
Hey ya, Hey ya, check, check, check
|
369
|
+
\"\"\"
|
370
|
+
"""
|
371
|
+
When I run `cucumber`
|
372
|
+
Then the features should all pass
|
373
|
+
|
374
|
+
Scenario: Use $kernel to use Kernel to capture exit code
|
375
|
+
|
376
|
+
Ruby's `Kernel`-module provides some helper methods like `exit`.
|
377
|
+
Unfortunately running `#exit` with `:in_process` would make the whole ruby
|
378
|
+
interpreter exit. So you might want to use our `FakeKernel`-module module
|
379
|
+
instead which overwrites `#exit`. This will also make our tests for
|
380
|
+
checking the exit code work. This example also uses the `thor`-library.
|
381
|
+
|
382
|
+
Given a file named "lib/cli/app/runner.rb" with:
|
383
|
+
"""
|
384
|
+
require 'cli/app/cli_parser'
|
385
|
+
|
386
|
+
module Cli
|
387
|
+
module App
|
388
|
+
class Runner
|
389
|
+
def initialize(argv, stdin, stdout, stderr, kernel)
|
390
|
+
@argv = argv
|
391
|
+
$kernel = kernel
|
392
|
+
$stdin = stdin
|
393
|
+
$stdout = stdout
|
394
|
+
$stderr = stderr
|
395
|
+
end
|
396
|
+
|
397
|
+
def execute!
|
398
|
+
Cli::App::CliParser.start @argv
|
399
|
+
end
|
400
|
+
end
|
401
|
+
end
|
402
|
+
end
|
403
|
+
"""
|
404
|
+
And a file named "lib/cli/app/cli_parser.rb" with:
|
405
|
+
"""
|
406
|
+
require 'thor'
|
407
|
+
|
408
|
+
module Cli
|
409
|
+
module App
|
410
|
+
class CliParser < Thor
|
411
|
+
def self.exit_on_failure?
|
412
|
+
true
|
413
|
+
end
|
414
|
+
|
415
|
+
desc 'do_it', 'Reverse input'
|
416
|
+
def do_it(*args)
|
417
|
+
$kernel.exit 5
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
"""
|
423
|
+
And a file named "features/in_process.feature" with:
|
424
|
+
"""
|
425
|
+
Feature: Run a command in process
|
426
|
+
@in-process
|
427
|
+
Scenario: Run command
|
428
|
+
When I run `reverse.rb do_it`
|
429
|
+
Then the exit status should be 5
|
430
|
+
"""
|
431
|
+
When I run `cucumber`
|
432
|
+
Then the features should all pass
|
433
|
+
|
434
|
+
Scenario: Using `:in_process` interactively is not supported
|
435
|
+
|
436
|
+
Reading from STDIN blocks ruby from going on. But writing to STDIN - e.g.
|
437
|
+
type some letters on keyboard - can only appear later, but this point is
|
438
|
+
never reached, because ruby is blocked.
|
439
|
+
|
440
|
+
Given the default aruba exit timeout is 5 seconds
|
441
|
+
And a file named "lib/cli/app/runner.rb" with:
|
442
|
+
"""
|
443
|
+
module Cli
|
444
|
+
module App
|
445
|
+
class Runner
|
446
|
+
def initialize(argv, stdin, stdout, stderr, kernel)
|
447
|
+
@stdin = stdin
|
448
|
+
end
|
449
|
+
|
450
|
+
def execute!
|
451
|
+
while res = @stdin.gets.to_s.chomp
|
452
|
+
break if res == 'quit'
|
453
|
+
puts res.reverse
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
"""
|
460
|
+
And a file named "features/in_process.feature" with:
|
461
|
+
"""
|
462
|
+
Feature: Run a command in process
|
463
|
+
@in-process
|
464
|
+
Scenario: Run command
|
465
|
+
Given the default aruba exit timeout is 2 seconds
|
466
|
+
When I run `reverse.rb do_it` interactively
|
467
|
+
When I type "hello"
|
468
|
+
Then the output should contain:
|
469
|
+
\"\"\"
|
470
|
+
hello
|
471
|
+
\"\"\"
|
472
|
+
"""
|
473
|
+
When I run `cucumber`
|
474
|
+
Then the exit status should not be 0
|
@@ -0,0 +1,104 @@
|
|
1
|
+
Feature: Send a signal to command
|
2
|
+
|
3
|
+
You can send a command a signal with the following steps:
|
4
|
+
|
5
|
+
- `When I send the signal "HUP" to the command started last`
|
6
|
+
- `When I send the signal "HUP" to the command "bin/cli"`
|
7
|
+
|
8
|
+
Or just use `kill` on compatible platforms.
|
9
|
+
|
10
|
+
Background:
|
11
|
+
Given I use a fixture named "cli-app"
|
12
|
+
|
13
|
+
Scenario: Sending signal to the command started last
|
14
|
+
Given an executable named "bin/cli" with:
|
15
|
+
"""bash
|
16
|
+
#!/usr/bin/env bash
|
17
|
+
function hup {
|
18
|
+
echo "Got signal HUP."
|
19
|
+
exit 0
|
20
|
+
}
|
21
|
+
|
22
|
+
trap hup HUP
|
23
|
+
while [ true ]; do sleep 1; done
|
24
|
+
"""
|
25
|
+
And a file named "features/run.feature" with:
|
26
|
+
"""
|
27
|
+
Feature: Run it
|
28
|
+
Scenario: Run command
|
29
|
+
Given the default aruba exit timeout is 5 seconds
|
30
|
+
And I wait 5 seconds for a command to start up
|
31
|
+
When I run `cli` in background
|
32
|
+
And I send the signal "HUP" to the command started last
|
33
|
+
Then the exit status should be 0
|
34
|
+
And the output should contain:
|
35
|
+
\"\"\"
|
36
|
+
Got signal HUP.
|
37
|
+
\"\"\"
|
38
|
+
"""
|
39
|
+
When I run `cucumber`
|
40
|
+
Then the features should all pass
|
41
|
+
|
42
|
+
Scenario: Sending signal to a command given by command line
|
43
|
+
Given an executable named "bin/cli" with:
|
44
|
+
"""bash
|
45
|
+
#!/usr/bin/env bash
|
46
|
+
function hup {
|
47
|
+
echo "Got signal HUP."
|
48
|
+
exit 0
|
49
|
+
}
|
50
|
+
|
51
|
+
trap hup HUP
|
52
|
+
while [ true ]; do sleep 1; done
|
53
|
+
"""
|
54
|
+
And a file named "features/run.feature" with:
|
55
|
+
"""
|
56
|
+
Feature: Run it
|
57
|
+
Scenario: Run command
|
58
|
+
Given the default aruba exit timeout is 5 seconds
|
59
|
+
And I wait 5 seconds for a command to start up
|
60
|
+
When I run `cli` in background
|
61
|
+
And I send the signal "HUP" to the command "cli"
|
62
|
+
Then the exit status should be 0
|
63
|
+
And the output should contain:
|
64
|
+
\"\"\"
|
65
|
+
Got signal HUP.
|
66
|
+
\"\"\"
|
67
|
+
"""
|
68
|
+
When I run `cucumber`
|
69
|
+
Then the features should all pass
|
70
|
+
|
71
|
+
@unsupported-on-platform-windows
|
72
|
+
@experimental
|
73
|
+
Scenario: Using the "kill"-command
|
74
|
+
|
75
|
+
`<pid-last-command-started>` in your command line will be replaced by the
|
76
|
+
PID of the last command started. Please note, this feature is experimental.
|
77
|
+
The name of the variable may change without further notice.
|
78
|
+
|
79
|
+
Given an executable named "bin/cli" with:
|
80
|
+
"""bash
|
81
|
+
#!/usr/bin/env bash
|
82
|
+
function hup {
|
83
|
+
echo "Got signal HUP."
|
84
|
+
exit 0
|
85
|
+
}
|
86
|
+
|
87
|
+
trap hup HUP
|
88
|
+
while [ true ]; do sleep 1; done
|
89
|
+
"""
|
90
|
+
And a file named "features/run.feature" with:
|
91
|
+
"""
|
92
|
+
Feature: Run it
|
93
|
+
Scenario: Run command
|
94
|
+
Given the default aruba exit timeout is 5 seconds
|
95
|
+
And I wait 5 seconds for a command to start up
|
96
|
+
When I run `cli` in background
|
97
|
+
And I run `kill -HUP <pid-last-command-started>`
|
98
|
+
Then the output should contain:
|
99
|
+
\"\"\"
|
100
|
+
Got signal HUP.
|
101
|
+
\"\"\"
|
102
|
+
"""
|
103
|
+
When I run `cucumber`
|
104
|
+
Then the features should all pass
|
@@ -0,0 +1,313 @@
|
|
1
|
+
Feature: Stop commands
|
2
|
+
|
3
|
+
After you've started a command, you might want to stop a command. To do that
|
4
|
+
you've got multiple possibilities.
|
5
|
+
|
6
|
+
On "JRuby" it's not possible to read the output of command which `echo`s a
|
7
|
+
string in a `signal`-handler - `TERM`, `HUP` etc. So please don't write
|
8
|
+
tests, which check on this, if your script needs to run on "JRuby". All other
|
9
|
+
output is logged to `STDERR` and/or `STDOUT` as normal.
|
10
|
+
|
11
|
+
Background:
|
12
|
+
Given I use a fixture named "cli-app"
|
13
|
+
|
14
|
+
Scenario: Terminate last command started
|
15
|
+
|
16
|
+
Terminating a command will send `SIGTERM` to the command.
|
17
|
+
|
18
|
+
Given an executable named "bin/cli1" with:
|
19
|
+
"""bash
|
20
|
+
#!/bin/bash
|
21
|
+
|
22
|
+
function term {
|
23
|
+
exit 100
|
24
|
+
}
|
25
|
+
|
26
|
+
trap term TERM
|
27
|
+
echo "Hello, Aruba!"
|
28
|
+
while [ true ]; do sleep 1; done
|
29
|
+
exit 1
|
30
|
+
"""
|
31
|
+
And an executable named "bin/cli2" with:
|
32
|
+
"""bash
|
33
|
+
#!/bin/bash
|
34
|
+
|
35
|
+
function term {
|
36
|
+
exit 155
|
37
|
+
}
|
38
|
+
|
39
|
+
trap term TERM
|
40
|
+
echo "Hello, Aruba!"
|
41
|
+
while [ true ]; do sleep 1; done
|
42
|
+
exit 1
|
43
|
+
"""
|
44
|
+
And a file named "features/stop.feature" with:
|
45
|
+
"""
|
46
|
+
Feature: Run it
|
47
|
+
Scenario: Run command
|
48
|
+
Given the default aruba exit timeout is 1 second
|
49
|
+
And I wait 2 seconds for a command to start up
|
50
|
+
When I run `cli1` in background
|
51
|
+
And I run `cli2` in background
|
52
|
+
And I terminate the command started last
|
53
|
+
Then the exit status should be 155
|
54
|
+
And the output should contain:
|
55
|
+
\"\"\"
|
56
|
+
Hello, Aruba!
|
57
|
+
\"\"\"
|
58
|
+
"""
|
59
|
+
When I run `cucumber`
|
60
|
+
Then the features should all pass
|
61
|
+
|
62
|
+
Scenario: Stop last command started
|
63
|
+
|
64
|
+
Stopping a command will wait n seconds for the command to stop and then
|
65
|
+
send `SIGTERM` to the command. Normally "n" is defined by the default exit
|
66
|
+
timeout of aruba.
|
67
|
+
|
68
|
+
Given an executable named "bin/cli1" with:
|
69
|
+
"""bash
|
70
|
+
#!/bin/bash
|
71
|
+
|
72
|
+
function term {
|
73
|
+
exit 100
|
74
|
+
}
|
75
|
+
|
76
|
+
trap term TERM
|
77
|
+
echo "Hello, Aruba!"
|
78
|
+
while [ true ]; do sleep 1; done
|
79
|
+
exit 1
|
80
|
+
"""
|
81
|
+
And an executable named "bin/cli2" with:
|
82
|
+
"""bash
|
83
|
+
#!/bin/bash
|
84
|
+
|
85
|
+
function term {
|
86
|
+
exit 155
|
87
|
+
}
|
88
|
+
|
89
|
+
trap term TERM
|
90
|
+
echo "Hello, Aruba!"
|
91
|
+
while [ true ]; do sleep 1; done
|
92
|
+
exit 1
|
93
|
+
"""
|
94
|
+
And a file named "features/stop.feature" with:
|
95
|
+
"""
|
96
|
+
Feature: Run it
|
97
|
+
Background:
|
98
|
+
|
99
|
+
Scenario: Run command
|
100
|
+
Given the default aruba exit timeout is 5 seconds
|
101
|
+
And I wait 2 seconds for a command to start up
|
102
|
+
When I run `cli1` in background
|
103
|
+
And I run `cli2` in background
|
104
|
+
And I stop the command started last
|
105
|
+
Then the exit status should be 155
|
106
|
+
And the output should contain:
|
107
|
+
\"\"\"
|
108
|
+
Hello, Aruba!
|
109
|
+
\"\"\"
|
110
|
+
"""
|
111
|
+
When I run `cucumber`
|
112
|
+
Then the features should all pass
|
113
|
+
|
114
|
+
Scenario: Terminate command given by commandline
|
115
|
+
|
116
|
+
Pass the commandline to the step to find the command, which should be
|
117
|
+
stopped.
|
118
|
+
|
119
|
+
Given an executable named "bin/cli1" with:
|
120
|
+
"""bash
|
121
|
+
#!/bin/bash
|
122
|
+
|
123
|
+
function term {
|
124
|
+
exit 100
|
125
|
+
}
|
126
|
+
|
127
|
+
trap term TERM
|
128
|
+
echo "Hello, Aruba!"
|
129
|
+
while [ true ]; do sleep 1; done
|
130
|
+
"""
|
131
|
+
And an executable named "bin/cli2" with:
|
132
|
+
"""bash
|
133
|
+
#!/bin/bash
|
134
|
+
|
135
|
+
function term {
|
136
|
+
exit 155
|
137
|
+
}
|
138
|
+
|
139
|
+
trap term TERM
|
140
|
+
echo "Hello, Aruba!"
|
141
|
+
while [ true ]; do sleep 1; done
|
142
|
+
exit 2
|
143
|
+
"""
|
144
|
+
And a file named "features/stop.feature" with:
|
145
|
+
"""
|
146
|
+
Feature: Run it
|
147
|
+
Background:
|
148
|
+
Given the default aruba exit timeout is 5 seconds
|
149
|
+
|
150
|
+
Scenario: Run command
|
151
|
+
Given I wait 2 seconds for a command to start up
|
152
|
+
When I run `cli1` in background
|
153
|
+
When I run `cli2` in background
|
154
|
+
And I terminate the command "cli1"
|
155
|
+
Then the exit status should be 100
|
156
|
+
And the output should contain:
|
157
|
+
\"\"\"
|
158
|
+
Hello, Aruba!
|
159
|
+
\"\"\"
|
160
|
+
"""
|
161
|
+
When I run `cucumber`
|
162
|
+
Then the features should all pass
|
163
|
+
|
164
|
+
Scenario: Stop command given by commandline
|
165
|
+
|
166
|
+
Stopping a command will wait n seconds for the command to stop and then
|
167
|
+
send `SIGTERM` to the command. Normally "n" is defined by the default exit
|
168
|
+
timeout of aruba.
|
169
|
+
|
170
|
+
Given an executable named "bin/cli1" with:
|
171
|
+
"""bash
|
172
|
+
#!/bin/bash
|
173
|
+
|
174
|
+
function term {
|
175
|
+
exit 155
|
176
|
+
}
|
177
|
+
|
178
|
+
trap term TERM
|
179
|
+
echo "Hello, Aruba!"
|
180
|
+
while [ true ]; do sleep 1; done
|
181
|
+
exit 1
|
182
|
+
"""
|
183
|
+
And an executable named "bin/cli2" with:
|
184
|
+
"""bash
|
185
|
+
#!/bin/bash
|
186
|
+
|
187
|
+
function term {
|
188
|
+
exit 100
|
189
|
+
}
|
190
|
+
|
191
|
+
trap term TERM
|
192
|
+
echo "Hello, Aruba!"
|
193
|
+
while [ true ]; do sleep 1; done
|
194
|
+
exit 1
|
195
|
+
"""
|
196
|
+
And a file named "features/stop.feature" with:
|
197
|
+
"""
|
198
|
+
Feature: Run it
|
199
|
+
Background:
|
200
|
+
Given the default aruba exit timeout is 5 seconds
|
201
|
+
|
202
|
+
Scenario: Run command
|
203
|
+
Given I wait 2 seconds for a command to start up
|
204
|
+
When I run `cli1` in background
|
205
|
+
And I run `cli2` in background
|
206
|
+
When I stop the command "cli1"
|
207
|
+
Then the exit status should be 155
|
208
|
+
And the output should contain:
|
209
|
+
\"\"\"
|
210
|
+
Hello, Aruba!
|
211
|
+
\"\"\"
|
212
|
+
"""
|
213
|
+
When I run `cucumber`
|
214
|
+
Then the features should all pass
|
215
|
+
|
216
|
+
Scenario: Stop command with configured signal
|
217
|
+
|
218
|
+
You can define a default signal which is used to stop all commands.
|
219
|
+
|
220
|
+
Given an executable named "bin/cli" with:
|
221
|
+
"""bash
|
222
|
+
#!/bin/bash
|
223
|
+
function hup {
|
224
|
+
exit 155
|
225
|
+
}
|
226
|
+
|
227
|
+
function term {
|
228
|
+
exit 100
|
229
|
+
}
|
230
|
+
|
231
|
+
trap hup HUP
|
232
|
+
trap term TERM
|
233
|
+
echo "Hello, Aruba!"
|
234
|
+
while [ true ]; do sleep 1; done
|
235
|
+
exit 1
|
236
|
+
"""
|
237
|
+
And a file named "features/run.feature" with:
|
238
|
+
"""
|
239
|
+
Feature: Run it
|
240
|
+
Scenario: Run command
|
241
|
+
Given the default aruba stop signal is "HUP"
|
242
|
+
And the default aruba exit timeout is 5 seconds
|
243
|
+
When I run `cli`
|
244
|
+
Then the exit status should be 155
|
245
|
+
"""
|
246
|
+
When I run `cucumber`
|
247
|
+
Then the features should all pass
|
248
|
+
|
249
|
+
@requires-ruby-platform-java
|
250
|
+
Scenario: STDERR/STDOUT is empty on JRUBY if output was written in "signal"-handler
|
251
|
+
Given an executable named "bin/cli1" with:
|
252
|
+
"""bash
|
253
|
+
#!/bin/bash
|
254
|
+
|
255
|
+
function term {
|
256
|
+
echo 'Hello, TERM'
|
257
|
+
exit 100
|
258
|
+
}
|
259
|
+
|
260
|
+
trap term TERM
|
261
|
+
echo "Hello, Aruba!"
|
262
|
+
while [ true ]; do sleep 1; done
|
263
|
+
exit 1
|
264
|
+
"""
|
265
|
+
And a file named "features/stop.feature" with:
|
266
|
+
"""
|
267
|
+
Feature: Run it
|
268
|
+
Scenario: Run command
|
269
|
+
Given the default aruba exit timeout is 1 second
|
270
|
+
And I wait 2 seconds for a command to start up
|
271
|
+
When I run `cli1` in background
|
272
|
+
And I terminate the command started last
|
273
|
+
Then the exit status should be 100
|
274
|
+
And the output should not contain:
|
275
|
+
\"\"\"
|
276
|
+
Hello, TERM
|
277
|
+
\"\"\"
|
278
|
+
"""
|
279
|
+
When I run `cucumber`
|
280
|
+
Then the features should all pass
|
281
|
+
|
282
|
+
@requires-ruby-platform-mri
|
283
|
+
Scenario: STDERR/STDOUT is written normally with MRI-Ruby if output was written in "signal"-handler
|
284
|
+
Given an executable named "bin/cli1" with:
|
285
|
+
"""bash
|
286
|
+
#!/bin/bash
|
287
|
+
|
288
|
+
function term {
|
289
|
+
echo 'Hello, TERM'
|
290
|
+
exit 100
|
291
|
+
}
|
292
|
+
|
293
|
+
trap term TERM
|
294
|
+
echo "Hello, Aruba!"
|
295
|
+
while [ true ]; do sleep 1; done
|
296
|
+
exit 1
|
297
|
+
"""
|
298
|
+
And a file named "features/stop.feature" with:
|
299
|
+
"""
|
300
|
+
Feature: Run it
|
301
|
+
Scenario: Run command
|
302
|
+
Given the default aruba exit timeout is 1 second
|
303
|
+
And I wait 2 seconds for a command to start up
|
304
|
+
When I run `cli1` in background
|
305
|
+
And I terminate the command started last
|
306
|
+
Then the exit status should be 100
|
307
|
+
And the output should contain:
|
308
|
+
\"\"\"
|
309
|
+
Hello, TERM
|
310
|
+
\"\"\"
|
311
|
+
"""
|
312
|
+
When I run `cucumber`
|
313
|
+
Then the features should all pass
|