1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00
Commit Graph

11 Commits

Author SHA1 Message Date
Azat Khuzhin
97233e90c8 Use flock instead of temporary files to avoid races/purge on ENOSPC/fsync time
- races: two parallel `autojump --add` can lead to database purging
  (overwriting by one of tmp files)
- ENOSPC: will leave autojump.txt empty, because no free space available
- fsync: can take a while

All of this can be fixed with fsync(2).
2015-10-04 21:44:45 +03:00
William Ting
23be6ab233 Tweak Windows temp.close() comment line. 2014-08-17 16:00:08 -07:00
timotei
c889aa013e Close the temporary file before re-opening it.
On Windows, we cannot reuse the temp.name to
reopen the file *unless* it has been closed
before [0].

This problem in turn made the `move_file`
request to fail, since the file was still
open at the time.

[0] https://docs.python.org/2/library/tempfile.html#tempfile.NamedTemporaryFile
2014-08-17 15:44:21 -07:00
William Ting
581b8d9617 autopep8'ed 2014-08-09 19:59:41 -07:00
William Ting
2100f993b3 formatting cleanup 2014-06-28 12:38:31 -07:00
William Ting
4826a0ef6b Use temporary files to prevent IO race conditions.
Refer to #260.
2014-03-09 19:56:13 -07:00
William Ting
4bd62e2293 minor refactor 2014-03-09 19:41:44 -07:00
William Ting
d0578b2c10 Remove accidentally creating tuples.
Fixes #244.
2014-03-09 19:04:29 -07:00
William Ting
35bc63c66e Fix encoding issues.
The original implementation used str.encode() on input and str.decode() on
output. However this would cause UnicodeDecodeError since certain characters
can't be encoded / decoded in ASCII.

The new solution is to use unicode() on all input strings and output UTF-8
encoded strings. This makes the assumption that the shell can handle UTF-8
strings.
2014-01-08 11:05:25 -06:00
William Ting
e5a97294ac fix data save 2013-12-30 18:13:52 -06:00
William Ting
a59d671fb0 rename python files to prevent system wide installation collisions 2013-12-30 14:49:34 -06:00