File tree Expand file tree Collapse file tree 4 files changed +66
-11
lines changed
test/API/iohandler/sigint Expand file tree Collapse file tree 4 files changed +66
-11
lines changed Original file line number Diff line number Diff line change @@ -4535,18 +4535,18 @@ class IOHandlerProcessSTDIO : public IOHandler {
4535
4535
break ;
4536
4536
} else
4537
4537
break ;
4538
+ }
4538
4539
4539
- if (select_helper.FDIsSetRead (pipe_read_fd)) {
4540
- size_t bytes_read;
4541
- // Consume the interrupt byte
4542
- Status error = m_pipe.Read (&ch, 1 , bytes_read);
4543
- if (error.Success ()) {
4544
- if (ch == ' q' )
4545
- break ;
4546
- if (ch == ' i' )
4547
- if (StateIsRunningState (m_process->GetState ()))
4548
- m_process->SendAsyncInterrupt ();
4549
- }
4540
+ if (select_helper.FDIsSetRead (pipe_read_fd)) {
4541
+ size_t bytes_read;
4542
+ // Consume the interrupt byte
4543
+ Status error = m_pipe.Read (&ch, 1 , bytes_read);
4544
+ if (error.Success ()) {
4545
+ if (ch == ' q' )
4546
+ break ;
4547
+ if (ch == ' i' )
4548
+ if (StateIsRunningState (m_process->GetState ()))
4549
+ m_process->SendAsyncInterrupt ();
4550
4550
}
4551
4551
}
4552
4552
}
Original file line number Diff line number Diff line change
1
+ include Makefile.rules
Original file line number Diff line number Diff line change
1
+ """
2
+ Test sending SIGINT Process IOHandler
3
+ """
4
+
5
+ import os
6
+
7
+ import lldb
8
+ from lldbsuite .test .decorators import *
9
+ from lldbsuite .test .lldbtest import *
10
+ from lldbsuite .test .lldbpexpect import PExpectTest
11
+
12
+ class TestCase (PExpectTest ):
13
+
14
+ mydir = TestBase .compute_mydir (__file__ )
15
+
16
+ def test (self ):
17
+ self .build (dictionary = {"CXX_SOURCES" :"cat.cpp" })
18
+ self .launch (executable = self .getBuildArtifact (), timeout = 5 )
19
+
20
+ self .child .sendline ("process launch" )
21
+ self .child .expect ("Process .* launched" )
22
+
23
+ self .child .sendline ("Hello cat" )
24
+ self .child .expect_exact ("read: Hello cat" )
25
+
26
+ self .child .sendintr ()
27
+ self .child .expect ("Process .* stopped" )
28
+ self .expect_prompt ()
29
+
30
+ self .expect ("bt" , substrs = ["input_copy_loop" ])
31
+
32
+ self .child .sendline ("continue" )
33
+ self .child .expect ("Process .* resuming" )
34
+
35
+ self .child .sendline ("Goodbye cat" )
36
+ self .child .expect_exact ("read: Goodbye cat" )
37
+
38
+ self .child .sendeof ()
39
+ self .child .expect ("Process .* exited" )
40
+ self .expect_prompt ()
41
+
42
+ self .quit ()
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+
3
+ void input_copy_loop () {
4
+ std::string str;
5
+ while (std::getline (std::cin, str))
6
+ std::cout << " read: " << str << std::endl;
7
+ }
8
+
9
+ int main () {
10
+ input_copy_loop ();
11
+ return 0 ;
12
+ }
You can’t perform that action at this time.
0 commit comments