summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-01-22 18:19:30 +0100
committerJohn Ankarström <john@ankarstrom.se>2022-01-22 18:19:30 +0100
commitd258adb0a5b6d3a7f44d6d1f7b1c40d503e74543 (patch)
tree97d89e526022e6c2402e2fe1dd8c11dce24abe58
parent43cce08cf13573930315ae09683b846b8212e5f0 (diff)
downloadsave-d258adb0a5b6d3a7f44d6d1f7b1c40d503e74543.tar.gz
M save.pl
M save.pl~
-rw-r--r--save.pl19
-rw-r--r--save.pl~15
2 files changed, 21 insertions, 13 deletions
diff --git a/save.pl b/save.pl
index bb3d7af..2c93580 100644
--- a/save.pl
+++ b/save.pl
@@ -33,8 +33,7 @@ added(0) :-
bold)),
send(D, append, new(E, editor)),
send(D, append, button(save,
- and(message(@prolog, save, E, C),
- message(D, destroy)))),
+ message(@prolog, save, E, C))),
send(D, append, button(cancel,
and(message(@prolog, reset),
message(D, destroy)))),
@@ -82,8 +81,14 @@ chain_atom_x(C, A0, A) :-
).
commit(Msg) :-
- setup_call_cleanup(
- process_create(path(git), ['commit', '-m', Msg],
- [detached(true)]),
- true,
- true).
+ process_create(path(git), ['commit', '-m', Msg],
+ [process(PID)]),
+ process_wait(PID, S),
+ commited(S).
+
+commited(1) :-
+ send(@display, report, error,
+ 'Files could not be saved.').
+
+commited(0) :-
+ halt.
diff --git a/save.pl~ b/save.pl~
index 801b1c9..8474511 100644
--- a/save.pl~
+++ b/save.pl~
@@ -33,8 +33,7 @@ added(0) :-
bold)),
send(D, append, new(E, editor)),
send(D, append, button(save,
- and(message(@prolog, save, E, C),
- message(D, destroy)))),
+ message(@prolog, save, E, C))),
send(D, append, button(cancel,
and(message(@prolog, reset),
message(D, destroy)))),
@@ -82,7 +81,11 @@ chain_atom_x(C, A0, A) :-
).
commit(Msg) :-
- setup_call_cleanup(
- process_create(path(git), ['commit', '-m', Msg], [detached(true)]),
- true,
- true).
+ process_create(path(git), ['commit', '-m', Msg],
+ [process(PID)]),
+ process_wait(PID, S).
+
+added(1) :-
+ send(@display, report, error,
+ 'Files could not be added to index.
+Ensure Git is in PATH.').