Skip to content
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

Should get-file and delete-file error if the file DNE? #1475

Open
JoeyZwicker opened this issue Mar 24, 2017 · 7 comments
Open

Should get-file and delete-file error if the file DNE? #1475

JoeyZwicker opened this issue Mar 24, 2017 · 7 comments

Comments

@JoeyZwicker
Copy link
Member

JoeyZwicker commented Mar 24, 2017

get-file and delete-file just return silently if they try to act on a file that doesn't exist. What should be the desired behavior in this case?

get-file should certainly error IMO.
delete-file I'm not 100% sure about. The file they tried to delete isn't there, so that's good, but more likely than not the user has a typo and was trying to delete something else.

@jdoliner
Copy link
Member

get-file erroring makes sense, delete-file probably should too but there should be a flag to ignore not found errors since that'll be a common use case.

@derekchiang
Copy link
Contributor

Is this for 1.3 or 1.4? The part about get-file failing silently.

@JoeyZwicker
Copy link
Member Author

v1.3 I think. In v1.4 it returns with no node at "/<file_name>" which could probably be clearer cuz I'm not sure what "node" is doing there.

@gabrielgrant
Copy link
Contributor

Copying cat and rm messages/behavior seems reasonable (fail if file doesn't exist; rm has a --force flag)

$ cat lsdf
cat: lsdf: No such file or directory
$ rm sfdsf
rm: cannot remove ‘sfdsf’: No such file or directory
$ rm --help
Usage: rm [OPTION]... FILE...
Remove (unlink) the FILE(s).

  -f, --force           ignore nonexistent files and arguments, never prompt

@gabrielgrant
Copy link
Contributor

not sure how we deal with recursive deletes or directories, though (but likely differently than rm)

@sjezewski sjezewski modified the milestone: v1.5 May 23, 2017
@sjezewski sjezewski removed the cleanup label Oct 18, 2017
@sjezewski
Copy link
Contributor

Recently w customer installations we've seen more usage of the go CLI for scripting. It's important for these commands to use meaningful exit codes.

@jdoliner
Copy link
Member

get file no longer fails silently and has a clear error message.
delete file still fails silently, we should change that and add a flag to ignore the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants