-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor annoyance: Control-C on ue4 run
raises an exception
#29
Comments
This is a general problem with Utility class which does a bunch of I/O operations but does not catch any exceptions related to them. These for sure shouldn't be treated as success, including Interrupting a process is considered as fatal error, imagine the following case: Though, I agree these cases should be catch, since current behavior is too confusing. Probably the easiest way to fix it is creating custom Exception for Utility class, then wrapping every I/O call with try/except block - if it fails, it should raise said custom Exception, which then can be catch inside of cli::main. This is how UnrealManagerException is being used right now to handle similar problems. |
This commit also... ...reverts: adamrehn@fed71c1 ...fixes: adamrehn#29
Proposed fix #65 With said change you should get something like this: $ ue4 run
# logging from Engine...
^C
(ue4cli) Error: (KeyboardInterrupt)
# return code 1 |
I've been "just living with" this for ages, and thought I should bug-report it.
I think it'd be nice if that if a
KeyboardInterrupt
is raised fromsubprocess.call
, the called subprocess was assumed to have handled it, and it was treated as a clean exit.It'd be nicer if the return code from the
subprocess.call
was returned like any other exit.And poking around, python/cpython#5026 and the relevant
wait
function, it looks like since Python 3.7 there's a_sigint_wait_secs
value which defaults to 250ms for the first control-c, and that's probably too short for us here, which is why we don't get the "nicer" version already.So a possible improvement would be to use the
Popen
object directly (replace the call tosubprocess.call
with its implementation, likeUtility.capture
) and then either change_sigint_wait_secs
before waiting to a higher first-time value, or wrap the call towait
with anotherKeyboardInterrupt
catch that perhaps doesn't put a timeout on the first control-C (assuming UE4's handling it) and has a second control-c catch that gives a timeout for the UE4 "force-quit", and a third control-C would immediately kill, if that second timeout is too long for the user in the heat of the moment.If I have some spare time, I could take a shot at implementing it (probably the latter approach, doing more
wait
calls in Utility.py, not changing_sigint_wait_secs
) unless you have any concerns, or want to offer particular advice on this?Should this only apply to
runEditor
? I haven't checked if UAT has a similar "one to exit cleanly, two to hard-kill" behaviour, or if that's Editor-only.The text was updated successfully, but these errors were encountered: