hundreds-breakfast-49010
10/12/2019, 12:02 AMKeyboardInterrupt
within a console_rule?aloof-angle-91616
10/15/2019, 5:57 PMhundreds-breakfast-49010
10/15/2019, 8:20 PM@console_rule
for running subprocessesaloof-angle-91616
10/15/2019, 8:21 PMaloof-angle-91616
10/15/2019, 8:21 PMaloof-angle-91616
10/15/2019, 8:21 PMhundreds-breakfast-49010
10/15/2019, 8:21 PMaloof-angle-91616
10/15/2019, 8:21 PMaloof-angle-91616
10/15/2019, 8:21 PMhundreds-breakfast-49010
10/15/2019, 8:22 PMtest.py
, but that could be any long-running programaloof-angle-91616
10/15/2019, 8:22 PMaloof-angle-91616
10/15/2019, 8:22 PMaloof-angle-91616
10/15/2019, 8:22 PMKeyboardInterrupt
is not a subclass of Exception
, but rather of BaseException
aloof-angle-91616
10/15/2019, 8:22 PMhundreds-breakfast-49010
10/15/2019, 8:22 PM./pants v2-run
on that branch, and hit ctrl-c, the exception you get is ultimately from a FFI null pointeraloof-angle-91616
10/15/2019, 8:22 PMaloof-angle-91616
10/15/2019, 8:23 PMhundreds-breakfast-49010
10/15/2019, 8:23 PMaloof-angle-91616
10/15/2019, 8:23 PMhundreds-breakfast-49010
10/15/2019, 8:23 PMaloof-angle-91616
10/15/2019, 8:23 PMaloof-angle-91616
10/15/2019, 8:23 PMaloof-angle-91616
10/15/2019, 8:23 PMaloof-angle-91616
10/15/2019, 8:23 PMhundreds-breakfast-49010
10/15/2019, 8:25 PMaloof-angle-91616
10/15/2019, 8:25 PMaloof-angle-91616
10/15/2019, 8:25 PMaloof-angle-91616
10/15/2019, 8:25 PMExceptionSink
hundreds-breakfast-49010
10/15/2019, 8:26 PMaloof-angle-91616
10/15/2019, 8:26 PMaloof-angle-91616
10/15/2019, 8:26 PMaloof-angle-91616
10/15/2019, 8:26 PMaloof-angle-91616
10/15/2019, 8:26 PMaloof-angle-91616
10/15/2019, 8:26 PMaloof-angle-91616
10/15/2019, 8:26 PMhundreds-breakfast-49010
10/15/2019, 8:26 PMtest.py
is doing this:hundreds-breakfast-49010
10/15/2019, 8:26 PMhundreds-breakfast-49010
10/15/2019, 8:27 PMhundreds-breakfast-49010
10/15/2019, 8:27 PMhundreds-breakfast-49010
10/15/2019, 8:27 PMhundreds-breakfast-49010
10/15/2019, 8:27 PMaloof-angle-91616
10/15/2019, 8:27 PMaloof-angle-91616
10/15/2019, 8:28 PMcffi
docs for is that the NULL pointer happens when there's an exception and it's not handled. what i am sure about is that we have already figured this out somewhere. just gotta find it brbhundreds-breakfast-49010
10/15/2019, 8:28 PMhundreds-breakfast-49010
10/15/2019, 8:28 PMaloof-angle-91616
10/15/2019, 8:28 PMaloof-angle-91616
10/15/2019, 8:29 PMhundreds-breakfast-49010
10/15/2019, 8:29 PMhundreds-breakfast-49010
10/15/2019, 8:29 PMaloof-angle-91616
10/15/2019, 8:29 PMstr(KeyboardInterrupt)
returnsaloof-angle-91616
10/15/2019, 8:29 PMaloof-angle-91616
10/15/2019, 8:29 PMaloof-angle-91616
10/15/2019, 8:29 PMstr(KeyboardInterrupt())
aloof-angle-91616
10/15/2019, 8:29 PMaloof-angle-91616
10/15/2019, 8:29 PMhundreds-breakfast-49010
10/15/2019, 8:29 PMaloof-angle-91616
10/15/2019, 8:29 PMhundreds-breakfast-49010
10/15/2019, 8:30 PMaloof-angle-91616
10/15/2019, 8:30 PMaloof-angle-91616
10/15/2019, 8:30 PMaloof-angle-91616
10/15/2019, 8:30 PMKeyboardInterrupt
stringification just means nobody provided a messagealoof-angle-91616
10/15/2019, 8:35 PMaloof-angle-91616
10/15/2019, 8:38 PMhundreds-breakfast-49010
10/15/2019, 8:39 PMaloof-angle-91616
10/15/2019, 8:40 PMExceptionSink.trapped_signals()
with a subclass of SignalHandler
hundreds-breakfast-49010
10/15/2019, 8:42 PMremote_pants_runner
it looks likealoof-angle-91616
10/15/2019, 8:42 PMaloof-angle-91616
10/15/2019, 8:43 PMaloof-angle-91616
10/15/2019, 8:43 PMaloof-angle-91616
10/15/2019, 8:45 PMaloof-angle-91616
10/15/2019, 8:45 PMaloof-angle-91616
10/15/2019, 8:45 PMaloof-angle-91616
10/15/2019, 8:46 PMaloof-angle-91616
10/15/2019, 8:46 PMComputing Select((<pants.engine.console.Console object at 0x1b9137e5450>+<pants.engine.interactive_runner.InteractiveRunner object at 0x1b9137e5550>+Specs(dependencies=(), matcher=SpecsMatcher(tags=(), exclude_patterns=()))), Run)
Computing Task(run(), (<pants.engine.console.Console object at 0x1b9137e5450>+<pants.engine.interactive_runner.InteractiveRunner object at 0x1b9137e5550>+Specs(dependencies=(), matcher=SpecsMatcher(tags=(), exclude_patterns=()))), Run, false)
Throw(signal only works in main thread)
Traceback (most recent call last):
File "/Users/dmcclanahan/tools/pants-v6/src/python/pants/engine/native.py", line 463, in extern_generator_send
res = c.from_value(func[0]).send(c.from_value(arg[0]))
File "/Users/dmcclanahan/tools/pants-v6/src/python/pants/rules/core/run.py", line 38, in run
with ExceptionSink.trapped_signals(SubprocessKillingHandler(res.popen)):
File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 112, in __enter__
return next(self.gen)
File "/Users/dmcclanahan/tools/pants-v6/src/python/pants/base/exception_sink.py", line 376, in trapped_signals
previous_signal_handler = cls.reset_signal_handler(new_signal_handler)
File "/Users/dmcclanahan/tools/pants-v6/src/python/pants/base/exception_sink.py", line 355, in reset_signal_handler
signal.signal(signum, handler)
File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
aloof-angle-91616
10/15/2019, 8:47 PMaloof-angle-91616
10/15/2019, 8:47 PMaloof-angle-91616
10/15/2019, 8:48 PMExceptionSink
might not be at all usable in `@rule`s because of assumptions about being on the main thread. it's fine for now, but a good note for the future imhoaloof-angle-91616
10/15/2019, 8:48 PMaloof-angle-91616
10/15/2019, 8:49 PMnative.py
again nowaloof-angle-91616
10/15/2019, 8:57 PMaloof-angle-91616
10/15/2019, 8:57 PMif
in scheduler.py
aloof-angle-91616
10/15/2019, 8:57 PMhundreds-breakfast-49010
10/15/2019, 9:13 PMhundreds-breakfast-49010
10/15/2019, 9:13 PMaloof-angle-91616
10/15/2019, 9:14 PMaloof-angle-91616
10/15/2019, 9:14 PMhundreds-breakfast-49010
10/15/2019, 9:14 PMaloof-angle-91616
10/15/2019, 9:14 PMaloof-angle-91616
10/15/2019, 9:15 PMhundreds-breakfast-49010
10/15/2019, 9:15 PMaloof-angle-91616
10/15/2019, 9:15 PMwitty-crayon-22786
10/15/2019, 9:16 PMaloof-angle-91616
10/15/2019, 9:17 PMwitty-crayon-22786
10/15/2019, 9:17 PMaloof-angle-91616
10/15/2019, 9:17 PMhundreds-breakfast-49010
10/15/2019, 9:18 PMaloof-angle-91616
10/15/2019, 9:18 PMhundreds-breakfast-49010
10/15/2019, 9:18 PMhundreds-breakfast-49010
10/15/2019, 9:19 PMaloof-angle-91616
10/15/2019, 9:20 PMaloof-angle-91616
10/15/2019, 9:20 PMaloof-angle-91616
10/15/2019, 9:20 PMaloof-angle-91616
10/15/2019, 9:20 PMaloof-angle-91616
10/15/2019, 9:20 PMaloof-angle-91616
10/15/2019, 9:21 PMException message: 1 Exception encountered:
Computing Select((<pants.engine.console.Console object at 0x1b917041ad0>+<pants.engine.interactive_runner.InteractiveRunner object at 0x1b917041410>+Specs(dependencies=(), matcher=SpecsMatcher(tags=(), exclude_patterns=()))), Run)
Value(Run(exit_code=0))
when using ctrl-chundreds-breakfast-49010
10/15/2019, 9:21 PMaloof-angle-91616
10/15/2019, 9:22 PMhundreds-breakfast-49010
10/15/2019, 9:22 PMhundreds-breakfast-49010
10/15/2019, 9:22 PMaloof-angle-91616
10/15/2019, 9:22 PMaloof-angle-91616
10/15/2019, 9:22 PMaloof-angle-91616
10/15/2019, 9:22 PMaloof-angle-91616
10/15/2019, 9:23 PMaloof-angle-91616
10/15/2019, 9:23 PMtest.py
totally works catching the exceptionaloof-angle-91616
10/15/2019, 9:23 PMaloof-angle-91616
10/15/2019, 9:23 PMhundreds-breakfast-49010
10/15/2019, 9:24 PMwitty-crayon-22786
10/15/2019, 9:24 PMhundreds-breakfast-49010
10/15/2019, 9:31 PMhundreds-breakfast-49010
10/15/2019, 9:32 PMaloof-angle-91616
10/15/2019, 9:33 PMwitty-crayon-22786
10/15/2019, 9:34 PMaloof-angle-91616
10/15/2019, 9:34 PMaloof-angle-91616
10/15/2019, 9:34 PMhundreds-breakfast-49010
10/15/2019, 9:35 PMwitty-crayon-22786
10/15/2019, 9:36 PMaloof-angle-91616
10/15/2019, 9:36 PMKeyboardInterrupt
isn't handled correctlyaloof-angle-91616
10/15/2019, 9:36 PMwitty-crayon-22786
10/15/2019, 9:37 PMyield Get
, which rules out "most" cases of exceptionswitty-crayon-22786
10/15/2019, 9:37 PMhundreds-breakfast-49010
10/15/2019, 9:38 PMhundreds-breakfast-49010
10/15/2019, 9:38 PMhundreds-breakfast-49010
10/15/2019, 9:38 PMhundreds-breakfast-49010
10/15/2019, 9:44 PMwitty-crayon-22786
10/15/2019, 9:44 PMwitty-crayon-22786
10/15/2019, 9:45 PMhundreds-breakfast-49010
10/15/2019, 9:50 PMhundreds-breakfast-49010
10/15/2019, 9:50 PMhundreds-breakfast-49010
10/15/2019, 9:50 PMexcept KeyboardInterrupt:
block, but that we might not want to allow that in a rule anyway?aloof-angle-91616
10/15/2019, 9:50 PMaloof-angle-91616
10/15/2019, 9:50 PMhundreds-breakfast-49010
10/15/2019, 9:52 PM@console_rule
work in principle, without being able to ignore a KeyboardInterrupt that only should get sent to a subprocess?hundreds-breakfast-49010
10/15/2019, 9:52 PMwitty-crayon-22786
10/15/2019, 9:53 PMaloof-angle-91616
10/15/2019, 10:00 PMaloof-angle-91616
10/15/2019, 10:01 PMaloof-angle-91616
10/15/2019, 10:01 PMhundreds-breakfast-49010
10/15/2019, 10:14 PMaloof-angle-91616
10/15/2019, 10:28 PMhundreds-breakfast-49010
10/15/2019, 11:57 PMhundreds-breakfast-49010
10/15/2019, 11:59 PMhundreds-breakfast-49010
10/16/2019, 12:00 AMwitty-crayon-22786
10/16/2019, 12:29 AMwitty-crayon-22786
10/16/2019, 12:30 AMhundreds-breakfast-49010
10/16/2019, 12:30 AMhundreds-breakfast-49010
10/16/2019, 12:30 AMhundreds-breakfast-49010
10/16/2019, 12:32 AMrun
console_rule should not yield to the engine and wait for whatever user executable is running to finish before control comes back to the console_rulewitty-crayon-22786
10/16/2019, 12:32 AMhundreds-breakfast-49010
10/16/2019, 12:32 AMwitty-crayon-22786
10/16/2019, 12:33 AMwitty-crayon-22786
10/16/2019, 12:34 AMhundreds-breakfast-49010
10/16/2019, 12:35 AMwitty-crayon-22786
10/16/2019, 12:36 AMhundreds-breakfast-49010
10/16/2019, 12:36 AMhundreds-breakfast-49010
10/16/2019, 12:37 AMhundreds-breakfast-49010
10/16/2019, 12:37 AMwitty-crayon-22786
10/16/2019, 12:37 AMhundreds-breakfast-49010
10/16/2019, 12:39 AMhundreds-breakfast-49010
10/16/2019, 12:40 AMrun
console_rule will yield to the engine with some type, the engine will receive that type, spawn a subprocess, and then block on that subprocess' completionhundreds-breakfast-49010
10/16/2019, 12:40 AMwitty-crayon-22786
10/16/2019, 12:41 AMhundreds-breakfast-49010
10/16/2019, 12:41 AMwitty-crayon-22786
10/16/2019, 12:41 AMhundreds-breakfast-49010
10/16/2019, 12:42 AMPopen
was, which is why I thought I could do it with the python subprocess module without invoking the enginehundreds-breakfast-49010
10/16/2019, 12:42 AMPopen
, whatever made sensewitty-crayon-22786
10/16/2019, 12:42 AMhundreds-breakfast-49010
10/16/2019, 12:43 AMhundreds-breakfast-49010
10/16/2019, 12:43 AMexecute
?witty-crayon-22786
10/16/2019, 12:43 AMhundreds-breakfast-49010
10/16/2019, 12:44 AMhundreds-breakfast-49010
10/16/2019, 12:44 AMwitty-crayon-22786
10/16/2019, 12:44 AMwitty-crayon-22786
10/16/2019, 12:45 AMwitty-crayon-22786
10/16/2019, 12:45 AMhundreds-breakfast-49010
10/16/2019, 12:46 AMrun
problem, so we could all have some actual code in front of us to look athundreds-breakfast-49010
10/16/2019, 12:46 AMhundreds-breakfast-49010
10/16/2019, 12:47 AMhundreds-breakfast-49010
10/16/2019, 12:47 AMwitty-crayon-22786
10/16/2019, 12:51 AMwitty-crayon-22786
10/16/2019, 12:52 AMhundreds-breakfast-49010
10/16/2019, 12:52 AMwitty-crayon-22786
10/16/2019, 12:52 AMhundreds-breakfast-49010
10/16/2019, 12:53 AMhundreds-breakfast-49010
10/16/2019, 12:53 AMwitty-crayon-22786
10/16/2019, 12:53 AMwitty-crayon-22786
10/16/2019, 12:55 AMhundreds-breakfast-49010
10/16/2019, 7:35 PMconsole_rule
?witty-crayon-22786
10/16/2019, 7:58 PMhundreds-breakfast-49010
10/16/2019, 7:58 PMwitty-crayon-22786
10/16/2019, 7:59 PMhundreds-breakfast-49010
10/16/2019, 7:59 PM