Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
900f2dc9
Commit
900f2dc9
authored
Nov 20, 2020
by
Alessio Caiazza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check waitDone channel only in case of os.PathError
parent
979ae9aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
15 deletions
+22
-15
internal/upload/exif/exif.go
internal/upload/exif/exif.go
+22
-15
No files found.
internal/upload/exif/exif.go
View file @
900f2dc9
...
...
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"os"
"os/exec"
"regexp"
...
...
@@ -37,24 +38,30 @@ func NewCleaner(ctx context.Context, stdin io.Reader) (io.Reader, error) {
}
func
(
c
*
cleaner
)
Read
(
p
[]
byte
)
(
int
,
error
)
{
select
{
case
<-
c
.
waitDone
:
return
0
,
io
.
EOF
default
:
n
,
err
:=
c
.
stdout
.
Read
(
p
)
if
err
==
io
.
EOF
{
if
waitErr
:=
c
.
wait
();
waitErr
!=
nil
{
log
.
WithContextFields
(
c
.
ctx
,
log
.
Fields
{
"command"
:
c
.
cmd
.
Args
,
"stderr"
:
c
.
stderr
.
String
(),
"error"
:
waitErr
.
Error
(),
})
.
Print
(
"exiftool command failed"
)
return
n
,
ErrRemovingExif
}
n
,
err
:=
c
.
stdout
.
Read
(
p
)
if
err
==
io
.
EOF
{
if
waitErr
:=
c
.
wait
();
waitErr
!=
nil
{
log
.
WithContextFields
(
c
.
ctx
,
log
.
Fields
{
"command"
:
c
.
cmd
.
Args
,
"stderr"
:
c
.
stderr
.
String
(),
"error"
:
waitErr
.
Error
(),
})
.
Print
(
"exiftool command failed"
)
return
n
,
ErrRemovingExif
}
}
return
n
,
err
// Calling c.cmd.Wait() will close the stdout pipe, any attempt to read from it will fail with an os.PathError.
// see: https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/233
if
_
,
ok
:=
err
.
(
*
os
.
PathError
);
ok
{
select
{
case
<-
c
.
waitDone
:
return
n
,
io
.
EOF
default
:
return
n
,
err
}
}
return
n
,
err
}
func
(
c
*
cleaner
)
startProcessing
(
stdin
io
.
Reader
)
error
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment