xwmx / nb

CLI and local web plain text note‑taking, bookmarking, and archiving with linking, tagging, filtering, search, Git versioning & syncing, Pandoc conversion, + more, in a single portable script.
https://xwmx.github.io/nb
GNU Affero General Public License v3.0
6.64k stars 188 forks source link

`nb sync` does not work when run non-interactively #278

Closed taketwo closed 12 months ago

taketwo commented 12 months ago

I have a systemd unit that periodically runs nb sync --all to keep my notebooks in sync. This worked fine for a long time, but recently I bumped nb version from 7.2.0 to 7.7.0 and it stopped working. The unit still prints

Oct 03 21:53:52 lemur systemd[2543]: Started nb-sync.service - Run nb notebook sync.
Oct 03 21:54:12 lemur nb[101839]: Syncing: notebook1...notebook2...notebook3...Done!

And exits with 0 status, however in reality nothing gets pulled/pushed. When I run this command interactively from terminal, it behaves as expected.

I bisected the changes and found that commit https://github.com/xwmx/nb/commit/92fff4148e145b90d392f086399c9ba8ae0f0897 broke non-interactive sync. Removing the && ! _piped_input condition fixes the issue for me. However, I assume it's there for a reason and simply dropping it breaks something else, so a more subtle fix is necessary.

xwmx commented 12 months ago

@taketwo Thank you for the detailed information. If you can, please try the latest version in the repository and let me know if it works.

taketwo commented 12 months ago

Works on my side; thanks for the prompt fix!

xwmx commented 12 months ago

@taketwo Good to hear. This change is now available in the latest release version 7.7.1.