Difference between revisions of "Null flush"
Jump to navigation
Jump to search
(Added test one-liner) |
|||
Line 2: | Line 2: | ||
To see how to use this in practice, read [[Daemon]]. |
To see how to use this in practice, read [[Daemon]]. |
||
+ | |||
+ | === Testing === |
||
+ | If you want to test that a pipe handles null flush correctly, you can use something like: |
||
+ | <pre> |
||
+ | cat <(echo -e "this\0is\0a\0test\0") /dev/stdin | your -z | pipe -z | goes -z | here -z |
||
+ | </pre> |
||
+ | where \0 are the nulls. Use Ctrl-D (^D) to close the inpue that cat keeps open. |
||
[[Category:Terminology]] |
[[Category:Terminology]] |
Revision as of 08:24, 20 January 2014
Null flush is an option (-z
) to most Apertium programs (and programs compatible with Apertium stream format) that flushes the output buffer upon receiving the \0
character instead of on end-of-file. This allows programs which call Apertium externally to keep a translator online, meaning they can avoid startup time for every translation.
To see how to use this in practice, read Daemon.
Testing
If you want to test that a pipe handles null flush correctly, you can use something like:
cat <(echo -e "this\0is\0a\0test\0") /dev/stdin | your -z | pipe -z | goes -z | here -z
where \0 are the nulls. Use Ctrl-D (^D) to close the inpue that cat keeps open.