core: add docs for ShellEscapeWriter

pull/4211/head
Jeffrey C. Ollie 2025-01-08 13:12:36 -06:00
parent e7c71df0b7
commit c85c277415
No known key found for this signature in database
GPG Key ID: 6F86035A6D97044E
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,11 @@
const std = @import("std"); const std = @import("std");
const testing = std.testing; const testing = std.testing;
/// Writer that escapes characters that shells treat specially to reduce the
/// risk of injection attacks or other such weirdness. Specifically excludes
/// linefeeds so that they can be used to delineate lists of file paths.
///
/// T should be a Zig type that follows the `std.io.Writer` interface.
pub fn ShellEscapeWriter(comptime T: type) type { pub fn ShellEscapeWriter(comptime T: type) type {
return struct { return struct {
child_writer: T, child_writer: T,