This is an automated email from the ASF dual-hosted git repository.
zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 69f15ed1 fix(runner): swallow the error form exec.Command.Run (#1988)
69f15ed1 is described below
commit 69f15ed11ad4cdaafbc44dc13b9dffe1ad1f9397
Author: Warren Chen <[email protected]>
AuthorDate: Sat May 28 14:51:50 2022 +0800
fix(runner): swallow the error form exec.Command.Run (#1988)
closes #1973
---
runner/directrun.go | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/runner/directrun.go b/runner/directrun.go
index cd08f45b..98e7b095 100644
--- a/runner/directrun.go
+++ b/runner/directrun.go
@@ -19,13 +19,13 @@ package runner
import (
"context"
- "os"
- "os/exec"
-
"github.com/apache/incubator-devlake/config"
"github.com/apache/incubator-devlake/logger"
"github.com/apache/incubator-devlake/plugins/core"
"github.com/spf13/cobra"
+ "os"
+ "os/signal"
+ "syscall"
)
func RunCmd(cmd *cobra.Command) {
@@ -64,9 +64,14 @@ func DirectRun(cmd *cobra.Command, args []string, pluginTask
core.PluginTask, op
panic(err)
}
- exec.Command("stty", "-F", "/dev/tty", "cbreak", "min", "1").Run()
-
ctx, cancel := context.WithCancel(context.Background())
+ sigc := make(chan os.Signal, 1)
+ signal.Notify(sigc, syscall.SIGTSTP)
+ go func() {
+ <-sigc
+ cancel()
+ }()
+
go func() {
buf := make([]byte, 1)
n, err := os.Stdin.Read(buf)