.
This commit is contained in:
parent
4af0d31c69
commit
75c0089807
@ -217,26 +217,27 @@ func (c *ChanIO) Write(p []byte) (int, error) {
|
||||
}
|
||||
|
||||
// read at least 1 byte, but don't block if nothing more in channel
|
||||
func (c *ChanIO) Read(data []byte) (int, error) {
|
||||
func (c *ChanIO) Read(data []byte) (idx int, err error) {
|
||||
var ok bool
|
||||
var idx int
|
||||
|
||||
data[idx], ok = <-c.ch
|
||||
if !ok {
|
||||
return 0, io.EOF
|
||||
err = io.EOF
|
||||
return
|
||||
}
|
||||
idx++
|
||||
|
||||
for len(c.ch) > 0 && idx < len(data) {
|
||||
data[idx], ok = <- c.ch
|
||||
if !ok {
|
||||
return idx, io.EOF
|
||||
err = io.EOF
|
||||
return
|
||||
}
|
||||
|
||||
idx++
|
||||
}
|
||||
|
||||
return idx, nil
|
||||
return
|
||||
}
|
||||
|
||||
type gitMsg struct {
|
||||
@ -482,10 +483,6 @@ func (e *RequestHandler) GitSubmoduleCommitId(cwd, packageName, commitId string)
|
||||
cmd.Env = []string{
|
||||
"GIT_CEILING_DIRECTORIES=" + e.GitPath,
|
||||
"GIT_CONFIG_GLOBAL=/dev/null",
|
||||
"GIT_AUTHOR_NAME=" + e.GitCommiter,
|
||||
"EMAIL=not@exist@src.opensuse.org",
|
||||
"GIT_LFS_SKIP_SMUDGE=1",
|
||||
"GIT_SSH_COMMAND=/usr/bin/ssh -o StrictHostKeyChecking=yes",
|
||||
}
|
||||
cmd.Dir = filepath.Join(e.GitPath, cwd)
|
||||
cmd.Stdout = &data_in
|
||||
@ -494,7 +491,8 @@ func (e *RequestHandler) GitSubmoduleCommitId(cwd, packageName, commitId string)
|
||||
e.Logger.LogError("%s", data)
|
||||
return len(data), nil
|
||||
})
|
||||
e.Log("command run: %v", cmd.Run())
|
||||
e.Log("command run: %v", cmd.Args)
|
||||
e.Error = cmd.Run()
|
||||
|
||||
foundLock.Lock()
|
||||
return subCommitId, len(subCommitId) == len(commitId)
|
||||
|
Loading…
Reference in New Issue
Block a user