Skip to content

Commit bb3899c

Browse files
committed
Make lua_aug_save behave like augsrun save
1 parent fc3242b commit bb3899c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/augtool.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,14 @@ static int lua_aug_save(lua_State *L) {
736736
lua_checkargs(L, "aug_save", 0);
737737

738738
r = aug_save(aug);
739-
if (r < 0)
740-
return lua_pusherror(L);
739+
if (r == -1) {
740+
lua_pushstring(L, "saving failed (run 'errors' for details)");
741+
lua_error(L);
742+
} else {
743+
r = aug_match(aug, "/augeas/events/saved", NULL);
744+
if (r > 0)
745+
printf("Saved %d file(s)\n", r);
746+
}
741747

742748
/* return the number of results */
743749
return 0;

0 commit comments

Comments
 (0)