Skip to content

Commit

Permalink
Merge pull request #274 from slingdata-io/v1.2.7
Browse files Browse the repository at this point in the history
V1.2.7
  • Loading branch information
flarco authored Apr 28, 2024
2 parents 39bf63a + 25f8a52 commit 2637941
Show file tree
Hide file tree
Showing 52 changed files with 1,608 additions and 722 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ dist/
.secrets
.DS_Store
demo/sling_commands_demo.workflow
demo/sling.demo.2023.10.screenstudio
*.screenstudio
./sling
core/dbio/filesys/test/dataset1M.csv
core/dbio/filesys/test/dataset100k.csv
cmd/sling/tests/suite/
cmd/sling/tests/replications/r.test.yaml

*..go

appicon.png
wails.json

cmd/sling/build/
cmd/sling/frontend
1 change: 1 addition & 0 deletions .goreleaser.linux.amd64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project_name: sling
before:
hooks:
- go mod edit -dropreplace='github.com/flarco/g' go.mod
- go mod edit -dropreplace='github.com/slingdata-io/sling' go.mod
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.linux.arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project_name: sling
before:
hooks:
- go mod edit -dropreplace='github.com/flarco/g' go.mod
- go mod edit -dropreplace='github.com/slingdata-io/sling' go.mod
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project_name: sling
before:
hooks:
- go mod edit -dropreplace='github.com/flarco/g' go.mod
- go mod edit -dropreplace='github.com/slingdata-io/sling' go.mod
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project_name: sling
before:
hooks:
- go mod edit -dropreplace='github.com/flarco/g' go.mod
- go mod edit -dropreplace='github.com/slingdata-io/sling' go.mod
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
Expand Down
64 changes: 31 additions & 33 deletions cmd/sling/sling_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/slingdata-io/sling-cli/core"
"github.com/slingdata-io/sling-cli/core/env"
"github.com/slingdata-io/sling-cli/core/sling"
"github.com/slingdata-io/sling-cli/core/store"

"github.com/flarco/g"
"github.com/flarco/g/net"
Expand All @@ -26,7 +27,7 @@ import (
"github.com/spf13/cast"
)

//go:embed *
//go:embed examples.sh
var slingFolder embed.FS
var examples = ``
var ctx = g.NewContext(context.Background())
Expand All @@ -36,6 +37,7 @@ var machineID = ""

func init() {
env.InitLogger()
store.InitDB()
}

var cliRunFlags = []g.Flag{
Expand Down Expand Up @@ -330,14 +332,9 @@ func init() {
examplesBytes, _ := slingFolder.ReadFile("examples.sh")
examples = string(examplesBytes)

// cliInteractive.Make().Add()
// cliAuth.Make().Add()
// cliCloud.Make().Add()
cliConns.Make().Add()
// cliProject.Make().Add()
cliRun.Make().Add()
cliUpdate.Make().Add()
// cliUi.Make().Add()

if telemetry {
if projectID == "" {
Expand Down Expand Up @@ -413,43 +410,44 @@ func main() {
sling.ShowProgress = os.Getenv("SLING_SHOW_PROGRESS") != "false"
database.UseBulkExportFlowCSV = cast.ToBool(os.Getenv("SLING_BULK_EXPORT_FLOW_CSV"))

go func() {
defer close(done)
exitCode = cliInit()
if !interrupted {
g.SentryFlush(time.Second * 2)
}
}()

exit := func() {
time.Sleep(50 * time.Millisecond) // so logger can flush
os.Exit(exitCode)
}

select {
case <-done:
exit()
case <-kill:
env.Println("\nkilling process...")
exitCode = 111
exit()
case <-interrupt:
g.SentryClear()
if cliRun.Sc.Used {
env.Println("\ninterrupting...")
interrupted = true
ctx.Cancel()
select {
case <-done:
case <-time.After(5 * time.Second):
go func() {
select {
case <-kill:
env.Println("\nkilling process...")
exitCode = 111
exit()
case <-interrupt:
g.SentryClear()
if cliRun.Sc.Used {
env.Println("\ninterrupting...")
interrupted = true
ctx.Cancel()
select {
case <-done:
case <-time.After(5 * time.Second):
}
}
exit()
return
case <-done:
exit()
}
exit()
return
}()

exitCode = cliInit(done)
if !interrupted {
g.SentryFlush(time.Second * 2)
}
time.Sleep(50 * time.Millisecond) // so logger can flush
}

func cliInit() int {
func cliInit(done chan struct{}) int {
defer close(done)

// recover from panic
defer func() {
Expand Down
Loading

0 comments on commit 2637941

Please sign in to comment.