diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 963943d..2ab3503 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,10 @@ -# You can override the included template(s) by including variable overrides -# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings -# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings -# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings -# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings -# Note that environment variables can be set in several places -# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence +image: golang:latest + stages: -- build -- test -- deploy -- review -- dast -- staging -- canary -- production -- incremental rollout 10% -- incremental rollout 25% -- incremental rollout 50% -- incremental rollout 100% -- performance -- cleanup -sast: - stage: test -include: -- template: Auto-DevOps.gitlab-ci.yml + - build + +job_build: + stage: build + script: + - go build console.go + \ No newline at end of file diff --git a/console.go b/console.go index 2fc57db..1fa4212 100644 --- a/console.go +++ b/console.go @@ -95,11 +95,10 @@ func listener(port int) { } } }() - fmt.Println("waiting exit") - aaaa := <-exit // 2. 尝试从通道中读取内容,若通道为空,则阻塞在此 + exitsignal := <-exit // 2. 尝试从通道中读取内容,若通道为空,则阻塞在此 sstop <- "stop sender" rstop <- "stop receiver" - fmt.Printf("command: %v\n", aaaa) + fmt.Printf("command: %v\n", exitsignal) return } @@ -256,10 +255,11 @@ func dial(host string, port int) { } } }() - aaaa := <-exit //尝试从通道中读取内容,若通道为空,则阻塞在此 + + exitsignal := <-exit //尝试从通道中读取内容,若通道为空,则阻塞在此 sstop <- "stop sender" rstop <- "stop receiver" - fmt.Printf("command: %v\n", aaaa) + fmt.Printf("command: %v\n", exitsignal) return } @@ -358,6 +358,16 @@ func sender(conn *net.TCPConn, exit chan string, receive chan int, sstop chan st receive <- 1 return } + + if strings.HasPrefix(inp, "cd ..") { + fmt.Println("don't use .. change dir") + return + } + + if strings.HasPrefix(inp, "cd .") { + fmt.Println("don't use . change dir") + return + } conn.Write([]byte(inp)) receive <- 1 return