Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(322)

Issue 78660045: cmd: No longer panic if cwd is deleted (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 1 month ago by vladislav.klyachin
Modified:
10 years, 1 month ago
Reviewers:
dimitern, mp+212182, dave, fwereade
Visibility:
Public.

Description

cmd: No longer panic if cwd is deleted This adds error return value for cmd.DefaultContext() function: func DefaultContext() (*Context, error) The previous implemenation causes panic if cmd.DefaultContext() was called with deleted current directory. https://code.launchpad.net/~klyachin/juju-core/100-lp-1227074-panic-in-deleted-directory/+merge/212182 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 4

Patch Set 2 : cmd: No longer panic if cwd is deleted #

Unified diffs Side-by-side diffs Delta from patch set Stats (+90 lines, -37 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M cmd/charm-admin/main.go View 2 chunks +8 lines, -1 line 0 comments Download
M cmd/cmd.go View 1 chunk +4 lines, -4 lines 0 comments Download
M cmd/cmd_test.go View 1 2 chunks +18 lines, -0 lines 0 comments Download
M cmd/juju/bootstrap_test.go View 1 6 chunks +6 lines, -6 lines 0 comments Download
M cmd/juju/cmd_test.go View 1 1 chunk +3 lines, -2 lines 0 comments Download
M cmd/juju/destroyenvironment_test.go View 1 5 chunks +14 lines, -13 lines 0 comments Download
M cmd/juju/main.go View 2 chunks +7 lines, -2 lines 0 comments Download
M cmd/juju/synctools_test.go View 1 1 chunk +1 line, -1 line 0 comments Download
M cmd/jujud/main.go View 3 chunks +9 lines, -5 lines 0 comments Download
M cmd/plugins/juju-metadata/metadata.go View 2 chunks +6 lines, -1 line 0 comments Download
M cmd/plugins/juju-restore/restore.go View 1 chunk +6 lines, -1 line 0 comments Download
M cmd/plugins/local/main.go View 1 chunk +6 lines, -1 line 0 comments Download

Messages

Total messages: 7
vladislav.klyachin
Please take a look.
10 years, 1 month ago (2014-03-21 16:33:12 UTC) #1
dimitern
LGTM with the suggestions below. https://codereview.appspot.com/78660045/diff/1/cmd/cmd_test.go File cmd/cmd_test.go (right): https://codereview.appspot.com/78660045/diff/1/cmd/cmd_test.go#newcode128 cmd/cmd_test.go:128: c.Assert(err, gc.NotNil) Please, check ...
10 years, 1 month ago (2014-03-21 16:45:59 UTC) #2
dave_cheney.net
Why is all this necessary. Why does cmd.DefaultContext() need the CWD ? What happens if ...
10 years, 1 month ago (2014-03-23 23:29:35 UTC) #3
fwereade
On 2014/03/23 23:29:35, dfc wrote: > Why is all this necessary. Why does cmd.DefaultContext() need ...
10 years, 1 month ago (2014-03-24 10:23:42 UTC) #4
fwereade
https://codereview.appspot.com/78660045/diff/1/cmd/cmd_test.go File cmd/cmd_test.go (right): https://codereview.appspot.com/78660045/diff/1/cmd/cmd_test.go#newcode128 cmd/cmd_test.go:128: c.Assert(err, gc.NotNil) On 2014/03/21 16:46:00, dimitern wrote: > Please, ...
10 years, 1 month ago (2014-03-24 10:23:54 UTC) #5
vladislav.klyachin
Please take a look.
10 years, 1 month ago (2014-03-24 10:44:52 UTC) #6
vladislav.klyachin
10 years, 1 month ago (2014-03-24 11:12:58 UTC) #7
On 2014/03/21 16:45:59, dimitern wrote:
> LGTM with the suggestions below.
> 
> https://codereview.appspot.com/78660045/diff/1/cmd/cmd_test.go
> File cmd/cmd_test.go (right):
> 
> https://codereview.appspot.com/78660045/diff/1/cmd/cmd_test.go#newcode128
> cmd/cmd_test.go:128: c.Assert(err, gc.NotNil)
> Please, check the actual error message. You can use gc.ErrorMatches for a
> regular expression match against the err.Error() message.
> 
> Like this:
> c.Assert(err, gc.ErrorMatches, `error: getwd: <whatever it reports>`)
Done
> 
> https://codereview.appspot.com/78660045/diff/1/cmd/juju/cmd_test.go
> File cmd/juju/cmd_test.go (right):
> 
> https://codereview.appspot.com/78660045/diff/1/cmd/juju/cmd_test.go#newcode126
> cmd/juju/cmd_test.go:126: ctx, _ := cmd.DefaultContext()
> It's bad to ignore errors like this, how about:
> 
> ctx, err := cmd.DefaultContext()
> c.Assert(err, gc.IsNil)
> 
> and take c *gc.C as an argument.
Done
> 
> https://codereview.appspot.com/78660045/diff/1/cmd/juju/main.go
> File cmd/juju/main.go (right):
> 
> https://codereview.appspot.com/78660045/diff/1/cmd/juju/main.go#newcode41
> cmd/juju/main.go:41: if err = juju.InitJujuHome(); err != nil {
> I'd prefer s/if err =/if err :=/ here.
Done
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b