-
Notifications
You must be signed in to change notification settings - Fork 1.4k
cancellation handler #4173
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
cancellation handler #4173
Conversation
297ec80
to
d64126c
Compare
6ff0d9a
to
ff62b8b
Compare
05e5d6f
to
1ddac2a
Compare
4eef326
to
f99b761
Compare
@@ -430,8 +424,7 @@ public class SwiftTool { | |||
|
|||
// Terminate all processes on receiving an interrupt signal. | |||
DefaultPluginScriptRunner.cancelAllRunningPlugins() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking forward to replacing this line with the new API you're adding (in a follow-on PR)! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happy to try and do a follow up PR for that, need to learn more about how plugin cancellation could work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
5112b06
to
4aece57
Compare
d529594
to
3fc7a50
Compare
@swift-ci please smoke test |
|
||
public typealias CancellationHandler = (DispatchTime) throws -> Void | ||
|
||
public class Cancellator: Cancellable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally was named "terminator" which is cute but less accurate. Happy to take suggestions for a nicer name
@swift-ci please smoke test |
e42de3a
to
a322bf7
Compare
@swift-ci please smoke test |
@abertelrud this is ready for review @compnerd could you help make sure this builds / works on Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delta: ~30KiB
Basics.dll: 276,992 -> 297,984
Commands.dll: 5,531,648 -> 5,532,672
Workspace.dll: 1,356,800 -> 1,3564,992
I'll play around with it itself to see if there are any issues, though I suspect not.
@swift-ci please smoke test |
c961e2c
to
0041ad0
Compare
@swift-ci please smoke test |
0041ad0
to
c138638
Compare
@swift-ci please smoke test |
Sources/Basics/Archiver+Zip.swift
Outdated
} | ||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left-over debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh yes
c138638
to
ead18a6
Compare
motivation: allow clients of SwiftPM to terminate background activities changes: * introduce new terminator class that is a registry for termination handlers * use the terminator instad of ProcessSet to manage the termination of active processes (eg git, tests) and build system * add cancel method to GitRepositoryProvider protocol so that it can be interuppted * add cancel methods to RepositoryManager, RegistryDownloadManager and HTTPClient so that it can be interuppted * change workspace initializer to take a terminator so that CLI and other consumer of libSwiftPM can interrupt * register intrupption points mentioned above in workspace * adjust related call sites, ie CLI signal handler now uses the workspace terminator to interuupt * add tests rdar://64900054 rdar://63723896
ead18a6
to
680e9ea
Compare
@swift-ci please smoke test |
This seemed to have dropped the Windows fixes and has broken the windows build: https://ci-external.swift.org/job/oss-swift-windows-toolchain-x86_64-vs2019/1130/console |
motivation: allow clients of SwiftPM to cancel background activities
changes:
rdar://64900054
rdar://63723896