summaryrefslogtreecommitdiffstats
path: root/src/clean.h
diff options
context:
space:
mode:
authorNicolas Despres <nicolas.despres@gmail.com>2011-05-02 14:46:31 (GMT)
committerNicolas Despres <nicolas.despres@gmail.com>2011-05-02 15:21:21 (GMT)
commit9412cb05008437b2ce534871ec86772b107ce23c (patch)
tree6f4c1eac7f0d6e4608d398b5f415b60c93a780e1 /src/clean.h
parent5113d8c29f2e165dabb05c5624055020704ba5fc (diff)
downloadNinja-9412cb05008437b2ce534871ec86772b107ce23c.zip
Ninja-9412cb05008437b2ce534871ec86772b107ce23c.tar.gz
Ninja-9412cb05008437b2ce534871ec86772b107ce23c.tar.bz2
Return non-zero status when errors occur.
Clean all was not returning non-zero when an error occur (like when failing to remove a directory). This patch fix the problem and add a test for it.
Diffstat (limited to 'src/clean.h')
-rw-r--r--src/clean.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/clean.h b/src/clean.h
index 6194aa0..8f0cfa4 100644
--- a/src/clean.h
+++ b/src/clean.h
@@ -40,7 +40,8 @@ public:
DiskInterface* disk_interface);
/// Clean the given @a target and all the file built for it.
- void CleanTarget(Node* target);
+ /// @return non-zero if an error occurs.
+ int CleanTarget(Node* target);
/// Clean the given target @a target.
/// @return non-zero if an error occurs.
int CleanTarget(const char* target);
@@ -49,10 +50,12 @@ public:
int CleanTargets(int target_count, char* targets[]);
/// Clean all built files.
- void CleanAll();
+ /// @return non-zero if an error occurs.
+ int CleanAll();
/// Clean all the file built with the given rule @a rule.
- void CleanRule(const Rule* rule);
+ /// @return non-zero if an error occurs.
+ int CleanRule(const Rule* rule);
/// Clean the file produced by the given @a rule.
/// @return non-zero if an error occurs.
int CleanRule(const char* rule);
@@ -74,7 +77,7 @@ public:
private:
/// Remove the file @a path.
/// @return whether the file has been removed.
- bool RemoveFile(const string& path);
+ int RemoveFile(const string& path);
/// @returns whether the file @a path exists.
bool FileExists(const string& path);
void Report(const string& path);
@@ -87,6 +90,7 @@ private:
void PrintHeader();
void PrintFooter();
void DoCleanRule(const Rule* rule);
+ void Reset();
private:
State* state_;
@@ -94,6 +98,7 @@ private:
set<string> removed_;
int cleaned_files_count_;
DiskInterface* disk_interface_;
+ int status_;
};
#endif // NINJA_CLEAN_H_