Bug 235524

Summary: [git-webkit] Improve handling of Ctrl-C during git-webkit commands while waiting for user input
Product: WebKit Reporter: Aakash Jain <aakash_jain>
Component: Tools / TestsAssignee: Jonathan Bedard <jbedard>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=235655

Description Aakash Jain 2022-01-24 09:10:46 PST
Improve handling of Ctrl-C during git-webkit commands. Currently it prints a stack-trace which might not be very readable. e.g.:

[WebKit]$git-webkit pr
Branch name: ^CTraceback (most recent call last):
  File "/Volumes/Apple/code/WebKit/Tools/Scripts/git-webkit", line 69, in <module>
    sys.exit(program.main(
  File "/Volumes/Apple/code/WebKit/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/__init__.py", line 134, in main
    return parsed.main(
  File "/Volumes/Apple/code/WebKit/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py", line 111, in main
    if Branch.main(args, repository, **kwargs):
  File "/Volumes/Apple/code/WebKit/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py", line 79, in main
    args.issue = Terminal.input('Branch name: ')
  File "/Volumes/Apple/code/WebKit/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/terminal.py", line 39, in input
    return (input if sys.version_info > (3, 0) else raw_input)(*args, **kwargs)
KeyboardInterrupt
Comment 1 Jonathan Bedard 2022-01-24 09:19:53 PST
In most cases, I think the stack-trace is the right option. However, a Ctrl-C during input seems like a special case (as the example stack-trace is), and one we could pretty easily handle differently
Comment 2 Aakash Jain 2022-01-24 09:22:15 PST
(In reply to Jonathan Bedard from comment #1)
> In most cases, I think the stack-trace is the right option. However, a Ctrl-C during input seems like a special case (as the example stack-trace is), and one we could pretty easily handle differently
Yeah, the specific use-case I had in mind was pressing Ctrl-C when user was asked for an input. Re-titled the bug appropriately.
Comment 3 Radar WebKit Bug Importer 2022-01-31 09:41:36 PST
<rdar://problem/88276494>
Comment 4 Jonathan Bedard 2022-01-31 12:28:35 PST
At the moment, one of the series of commits in https://github.com/WebKit/WebKit/pull/99 has this fix.
Comment 5 Jonathan Bedard 2022-02-02 10:55:28 PST
Fixed in 246695@main (r288966)
Comment 6 Aakash Jain 2022-02-02 11:00:15 PST
Thanks! Seems to be working fine. 
e.g.:
[/Volumes/Apple/code/WebKit/Tools/CISupport/ews-build]$git-webkit pr
'main' is not a pull request branch, enter name of new branch: ^C
User interrupted program