Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
da786a8d
Unverified
Commit
da786a8d
authored
Sep 06, 2016
by
Jess Frazelle
Committed by
Jess Frazelle
Oct 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hack/e2e.go: listen for Interrupt signal and attempt cleanup if using --down
Signed-off-by:
Jess Frazelle
<
me@jessfraz.com
>
Signed-off-by:
Jess Frazelle
<
acidburn@google.com
>
parent
41f17bd9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
e2e.go
hack/e2e.go
+16
-0
No files found.
hack/e2e.go
View file @
da786a8d
...
...
@@ -25,6 +25,7 @@ import (
"log"
"os"
"os/exec"
"os/signal"
"os/user"
"path/filepath"
"strconv"
...
...
@@ -159,6 +160,21 @@ func main() {
log
.
Fatalf
(
"Error creating deployer: %v"
,
err
)
}
if
*
down
{
// listen for signals such as ^C and gracefully attempt to clean up
c
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
c
,
os
.
Interrupt
)
go
func
()
{
for
range
c
{
log
.
Print
(
"Captured ^C, gracefully attempting to cleanup resources.."
)
if
err
:=
deploy
.
Down
();
err
!=
nil
{
log
.
Printf
(
"Tearing down deployment failed: %v"
,
err
)
os
.
Exit
(
1
)
}
}
}()
}
if
err
:=
run
(
deploy
);
err
!=
nil
{
log
.
Fatalf
(
"Something went wrong: %s"
,
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment