Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
f68e0008
Commit
f68e0008
authored
Aug 19, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer/plugin: Killed bool to avoid panics when killing clients
parent
8b00c828
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
6 deletions
+12
-6
packer/plugin/builder.go
packer/plugin/builder.go
+1
-1
packer/plugin/client.go
packer/plugin/client.go
+4
-0
packer/plugin/command.go
packer/plugin/command.go
+1
-1
packer/plugin/hook.go
packer/plugin/hook.go
+1
-1
packer/plugin/post_processor.go
packer/plugin/post_processor.go
+1
-1
packer/plugin/provisioner.go
packer/plugin/provisioner.go
+1
-1
signal.go
signal.go
+3
-1
No files found.
packer/plugin/builder.go
View file @
f68e0008
...
...
@@ -40,7 +40,7 @@ func (b *cmdBuilder) Cancel() {
func
(
c
*
cmdBuilder
)
checkExit
(
p
interface
{},
cb
func
())
{
if
c
.
client
.
Exited
()
&&
cb
!=
nil
{
cb
()
}
else
if
p
!=
nil
{
}
else
if
p
!=
nil
&&
!
Killed
{
log
.
Panic
(
p
)
}
}
packer/plugin/client.go
View file @
f68e0008
...
...
@@ -20,6 +20,10 @@ import (
"unicode"
)
// If this is true, then the "unexpected EOF" panic will not be
// raised throughout the clients.
var
Killed
=
false
// This is a slice of the "managed" clients which are cleaned up when
// calling Cleanup
var
managedClients
=
make
([]
*
Client
,
0
,
5
)
...
...
packer/plugin/command.go
View file @
f68e0008
...
...
@@ -45,7 +45,7 @@ func (c *cmdCommand) Synopsis() (result string) {
func
(
c
*
cmdCommand
)
checkExit
(
p
interface
{},
cb
func
())
{
if
c
.
client
.
Exited
()
{
cb
()
}
else
if
p
!=
nil
{
}
else
if
p
!=
nil
&&
!
Killed
{
log
.
Panic
(
p
)
}
}
packer/plugin/hook.go
View file @
f68e0008
...
...
@@ -22,7 +22,7 @@ func (c *cmdHook) Run(name string, ui packer.Ui, comm packer.Communicator, data
func
(
c
*
cmdHook
)
checkExit
(
p
interface
{},
cb
func
())
{
if
c
.
client
.
Exited
()
{
cb
()
}
else
if
p
!=
nil
{
}
else
if
p
!=
nil
&&
!
Killed
{
log
.
Panic
(
p
)
}
}
packer/plugin/post_processor.go
View file @
f68e0008
...
...
@@ -31,7 +31,7 @@ func (c *cmdPostProcessor) PostProcess(ui packer.Ui, a packer.Artifact) (packer.
func
(
c
*
cmdPostProcessor
)
checkExit
(
p
interface
{},
cb
func
())
{
if
c
.
client
.
Exited
()
{
cb
()
}
else
if
p
!=
nil
{
}
else
if
p
!=
nil
&&
!
Killed
{
log
.
Panic
(
p
)
}
}
packer/plugin/provisioner.go
View file @
f68e0008
...
...
@@ -31,7 +31,7 @@ func (c *cmdProvisioner) Provision(ui packer.Ui, comm packer.Communicator) error
func
(
c
*
cmdProvisioner
)
checkExit
(
p
interface
{},
cb
func
())
{
if
c
.
client
.
Exited
()
{
cb
()
}
else
if
p
!=
nil
{
}
else
if
p
!=
nil
&&
!
Killed
{
log
.
Panic
(
p
)
}
}
signal.go
View file @
f68e0008
...
...
@@ -26,7 +26,9 @@ func setupSignalHandlers(env packer.Environment) {
env
.
Ui
()
.
Error
(
"Interrupt signal received twice. Forcefully exiting now."
)
// Force kill all the plugins
// Force kill all the plugins, but mark that we're killing them
// first so that we don't get panics everywhere.
plugin
.
Killed
=
true
plugin
.
CleanupClients
()
os
.
Exit
(
1
)
}()
...
...
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