Commit b02c7a1
authored
printer: make sure output and errfile are always truncated (#2160)
Output and error files should be always truncated.
It is imperative that either the output file is truncated OR that the
cursor positioning (to EOF) is done before any write to the file
happens. If not, then we might have situations such as:
$ cat ebpf_events.json | wc -l
58010
$ cat ebpf_events.json | wc -l
58010
$ cat ebpf_events.json | wc -l
58011
$ cat ebpf_events.json | wc -l
58002
$ cat ebpf_events.json | wc -l
57989
$ cat ebpf_events.json | wc -l
57978
when the output file is truncated while being written to.1 parent 4b94f4b commit b02c7a1
File tree
3 files changed
+24
-35
lines changed- cmd/tracee-ebpf
- flags
- internal/printer
3 files changed
+24
-35
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
124 | 121 | | |
125 | 122 | | |
126 | 123 | | |
| |||
129 | 126 | | |
130 | 127 | | |
131 | 128 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
143 | 137 | | |
144 | 138 | | |
145 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | 221 | | |
235 | 222 | | |
236 | 223 | | |
| |||
0 commit comments