Fix session delete bug in doCopy and doCast session

This commit is contained in:
Harshavardhana
2015-07-25 21:02:03 -07:00
parent 933c998cc2
commit c253ad76a8
3 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -263,12 +263,12 @@ func runCastCmd(ctx *cli.Context) {
checkCastSyntax(ctx)
session := newSessionV2()
defer session.Close()
var err error
session.Header.CommandType = "cast"
session.Header.RootPath, err = os.Getwd()
if err != nil {
session.Close()
session.Delete()
console.Fatalf("Unable to get current working folder. %s\n", err)
}
@@ -276,10 +276,12 @@ func runCastCmd(ctx *cli.Context) {
// extract URLs.
session.Header.CommandArgs, err = args2URLs(ctx.Args())
if err != nil {
session.Close()
session.Delete()
console.Fatalf("One or more unknown URL types found in %s. %s\n", ctx.Args(), err)
}
doCastCmdSession(session)
session.Close()
session.Delete()
}
+3 -1
View File
@@ -266,12 +266,12 @@ func runCopyCmd(ctx *cli.Context) {
checkCopySyntax(ctx)
session := newSessionV2()
defer session.Close()
var err error
session.Header.CommandType = "cp"
session.Header.RootPath, err = os.Getwd()
if err != nil {
session.Close()
session.Delete()
console.Fatalf("Unable to get current working folder. %s\n", err)
}
@@ -279,10 +279,12 @@ func runCopyCmd(ctx *cli.Context) {
// extract URLs.
session.Header.CommandArgs, err = args2URLs(ctx.Args())
if err != nil {
session.Close()
session.Delete()
console.Fatalf("One or more unknown URL types found %s. %s\n", ctx.Args(), err)
}
doCopyCmdSession(session)
session.Close()
session.Delete()
}
+1 -1
View File
@@ -198,7 +198,7 @@ func loadSessionV2(sid string) (*sessionV2, error) {
s.DataFP, err = os.Open(getSessionDataFile(s.SessionID))
if err != nil {
console.Fatalf("Unable to open session data file \""+getSessionDataFile(s.SessionID)+"\". %s", NewIodine(iodine.New(errNotConfigured{}, nil)))
console.Fatalf("Unable to open session data file \""+getSessionDataFile(s.SessionID)+"\". %s\n", NewIodine(iodine.New(err, nil)))
}
return s, nil