Skip to content

Commit 8f9e8bf

Browse files
committed
AG-43382: fixed incorrect coding when creating patch via spawn process
Squashed commit of the following: commit 6cc97ae Author: Dmitriy Seregin <d.seregin@adguard.com> Date: Wed Jun 18 15:55:04 2025 +0300 update changelog commit 1a8b6cd Author: Dmitriy Seregin <d.seregin@adguard.com> Date: Wed Jun 18 15:51:57 2025 +0300 AG-43382: fixed incorrect coding when creating patch via spawn process
1 parent 7874bf3 commit 8f9e8bf

5 files changed

Lines changed: 46 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.1.2] - 2025-06-18
9+
10+
## Fixed
11+
12+
- Incorrect coding when preparing a patch [FiltersRegistry#1091].
13+
14+
[1.1.2]: https://github.com/AdguardTeam/DiffBuilder/compare/v1.1.1...v1.1.2
15+
[FiltersRegistry#1091]: https://github.com/AdguardTeam/FiltersRegistry/issues/1091
16+
817
## [1.1.1] - 2025-06-09
918

1019
### Changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adguard/diff-builder",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "A tool for generating differential updates for filter lists.",
55
"repository": {
66
"type": "git",

src/common/spawn-diff.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export const spawnDiff = (oldFilePath: string, newFilePath: string): Promise<str
1414
// '-n' option is used to build a patch in RCS format
1515
const diffProcess = spawn('diff', ['-n', oldFilePath, newFilePath]);
1616

17+
// Set encoding for stdout and stderr to 'utf-8'
18+
diffProcess.stdout.setEncoding('utf-8');
19+
diffProcess.stderr.setEncoding('utf-8');
20+
1721
let output = '';
1822
let errorOutput = '';
1923

tests/diff-builder.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import {
1616
FILE_7,
1717
FILE_7_8_PATCH,
1818
FILE_8,
19+
FILE_WITH_EXTENDED_SYMBOLS_OLD,
20+
FILE_WITH_EXTENDED_SYMBOLS_NEW,
21+
FILE_WITH_EXTENDED_SYMBOLS_PATCH,
1922
} from './stubs/random-files';
2023
import { FILTER_1_V_1_0_0, FILTER_1_V_1_0_1, PATCH_1_1_0_0 } from './stubs/simple';
2124
import { FILTER_2_V_1_0_0, FILTER_2_V_1_0_1, PATCH_2_1_0_0 } from './stubs/validation';
@@ -76,6 +79,7 @@ describe('check diff-builder', () => {
7679
[FILE_3, FILE_4, FILE_3_4_PATCH],
7780
[FILE_5, FILE_6, FILE_5_6_PATCH],
7881
[FILE_7, FILE_8, FILE_7_8_PATCH],
82+
[FILE_WITH_EXTENDED_SYMBOLS_OLD, FILE_WITH_EXTENDED_SYMBOLS_NEW, FILE_WITH_EXTENDED_SYMBOLS_PATCH],
7983
];
8084

8185
it.each(cases)('creates patch', async (

0 commit comments

Comments
 (0)