⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Backport192
All Projects
Ruby
»
Backport192
Overview
Activity
Issues
Like
Download (730 Bytes)
Backport #5253
ยป pty_exitstatus_test.rb
thinkerbot (Simon Chiang)
, 09/01/2011 05:34 AM
require
'pty'
require
'test/unit'
class
PTYExitStatusTest
<
Test
::
Unit
::
TestCase
def
clear_process_status
system
"true"
assert_equal
0
,
$?
.
exitstatus
end
def
test_pty_with_wait_sets_exit_status_correctly_for_immediate_exit
clear_process_status
PTY
.
spawn
(
"exit 8"
)
do
|
r
,
w
,
pid
|
Process
.
wait
(
pid
)
end
assert_equal
8
,
$?
.
exitstatus
end
# I don't know what the truly correct behavior should be here... error?
def
test_pty_with_wait_sets_exit_status_like_system_for_empty_command
clear_process_status
system
""
assert_equal
127
,
$?
.
exitstatus
clear_process_status
PTY
.
spawn
(
""
)
do
|
r
,
w
,
pid
|
Process
.
wait
(
pid
)
end
assert_equal
127
,
$?
.
exitstatus
end
end
(1-1/1)
Loading...