-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix repl always return 0 #1286
fix repl always return 0 #1286
Changes from 2 commits
4cc9012
71dde16
ff551ad
1ed77ea
42ca196
48652fe
520af56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,6 @@ func (m *model) saveDB(db *DB, table string, session *pb.Session) (e error) { | |
if e != nil { | ||
return fmt.Errorf("cannot create sqlfs file %s: %v", table, e) | ||
} | ||
defer sqlf.Close() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe should check the error of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it safe if we call |
||
|
||
// Use a bytes.Buffer as the gob message container to separate | ||
// the message from the following tarball. | ||
|
@@ -105,6 +104,10 @@ func (m *model) saveDB(db *DB, table string, session *pb.Session) (e error) { | |
if e := cmd.Run(); e != nil { | ||
return fmt.Errorf("tar stderr: %v\ntar cmd %v", errBuf.String(), e) | ||
} | ||
|
||
if e := sqlf.Close(); e != nil { | ||
return fmt.Errorf("close sqlfs error: %v", e) | ||
} | ||
return nil | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd better keep this check somewhere to avoid printing error message twice when logging to stderr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can use
log.Fatalf
to exit if some errors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log.Fatalf
will terminate the program, that's no good for the interactive mode of REPL.