command: disable backup with "-" [GH-1072]

/cc @phinze
This commit is contained in:
Mitchell Hashimoto 2015-03-02 09:11:49 -08:00
parent 80c129a961
commit 8e76a02a56
2 changed files with 11 additions and 3 deletions

View File

@ -1113,6 +1113,12 @@ func TestApply_disableBackup(t *testing.T) {
if err == nil || !os.IsNotExist(err) {
t.Fatalf("backup should not exist")
}
// Ensure there is no literal "-"
_, err = os.Stat("-")
if err == nil || !os.IsNotExist(err) {
t.Fatalf("backup should not exist")
}
}
func testHttpServer(t *testing.T) net.Listener {

View File

@ -154,9 +154,11 @@ func State(opts *StateOpts) (*StateResult, error) {
backupPath = opts.BackupPath
}
result.State = &state.BackupState{
Real: result.State,
Path: backupPath,
if backupPath != "-" {
result.State = &state.BackupState{
Real: result.State,
Path: backupPath,
}
}
}