質問編集履歴
1
実行結果を追記
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -35,6 +35,29 @@
|
|
|
35
35
|
raise KeyboardInterrupt
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
実行結果
|
|
39
|
+
キーボードからCtl-Cを入力するとキャッチできたのですが,
|
|
40
|
+
test.pyからのKeyboardInterruptはキャッチされませんでした。
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
>python mian.py
|
|
44
|
+
start
|
|
45
|
+
end
|
|
46
|
+
Traceback (most recent call last):
|
|
47
|
+
File "test.py", line 6, in <module>
|
|
48
|
+
raise KeyboardInterrupt
|
|
49
|
+
KeyboardInterrupt # ←test.pyのKeyboardInterrupt
|
|
50
|
+
catch # ←キーボードからCtl-C
|
|
51
|
+
start # ←再生成
|
|
52
|
+
end
|
|
53
|
+
Traceback (most recent call last):
|
|
54
|
+
File "print.py", line 6, in <module>
|
|
55
|
+
raise KeyboardInterrupt
|
|
56
|
+
KeyboardInterrupt
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
38
61
|
ちなみにtest.pyはwebサーバのようなもので,
|
|
39
62
|
常にリクエストを待っている状態で,
|
|
40
63
|
returnして終了させることができないので,
|