Skip to content

Commit

Permalink
implemented ctrl+c for docker-compose driver for action: run
Browse files Browse the repository at this point in the history
  • Loading branch information
xmik committed Jan 4, 2020
1 parent 35241d4 commit cf9f63c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 0.9.0 (2020-Jan-04)

* Implemented Ctrl+C (SigInt) to work for action: run for both drivers (docker and docker-compose).
The change in the run action for docker-compose driver is that now Dojo first explicitly invokes the pull action
and then it invokes the run action.

### 0.8.0 (2020-Jan-01)

* Docker-composer driver: enable printing logs of non default docker containers either to console or to file.
Expand Down
14 changes: 14 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,24 @@ func main() {
shellService.SetEnvironment(envService.GetVariables())

if mergedConfig.Action == "pull" {
// just pull the image(s) and exit
exitstatus := driver.HandlePull(mergedConfig)
os.Exit(exitstatus)
}

if mergedConfig.Action == "run" && mergedConfig.Driver == "docker-compose" {
// We have to first pull the image(s) in order to support ctrl+c while pulling.
// If we didn't do it, then docker-compose run command could result in starting some containers
// while pulling some images. Then, on ctrl+c we would stop the docker-compose process, which
// would stop the pulling and also the current (this) main thread. This means that there is no
// way to perform cleaning and the already started containers would be left running.
// (This is not the case for the driver: docker, but it we could implement in the same way).
exitstatus := driver.HandlePull(mergedConfig)
if exitstatus !=0 {
panic("Exit status from pulling the image was not 0")
}
}

// action is run

// This variable is needed to perform cleanup on any signal.
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main
const DojoVersion = "0.8.0"
const DojoVersion = "0.9.0"

0 comments on commit cf9f63c

Please sign in to comment.