Skip to content

Commit 1af196f

Browse files
committed
Detect "no crontab for X"
1 parent f97c216 commit 1af196f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
## Next version
4+
5+
- Detect "no crontab for X"
6+
7+
## v0.1.0
8+
9+
- Initial release

lib/cronedit.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ int main(int argc, char* argv[]) {
139139
crontab = read_file(args.filename);
140140
} else {
141141
crontab = exec("crontab -l 2>&1");
142+
if (crontab.substr(0, 14) == "no crontab for") {
143+
crontab = "";
144+
}
142145
if (crontab.substr(0, 23) == "crontab: no crontab for") {
143146
crontab = "";
144147
}

0 commit comments

Comments
 (0)