Fix session delete bug in doCopy and doCast session
This commit is contained in:
+3
-1
@@ -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
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user