From cb27b231db58d37cceec6e5be5c3116a91c27b67 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Tue, 28 Feb 2023 11:16:46 +0000 Subject: [PATCH] Add newline to pipeline stdin for POSIX compliance See #568 --- packages/server/src/scan-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/scan-controller.js b/packages/server/src/scan-controller.js index 607fe242..f9d902e0 100644 --- a/packages/server/src/scan-controller.js +++ b/packages/server/src/scan-controller.js @@ -83,13 +83,13 @@ class ScanController { // Apply filters if (this.request.filters.length > 0) { - const stdin = files.map(f => f.name).join('\n'); + const stdin = files.map(f => `${f.name}\n`).join(''); const cmd = `convert @- ${application.filterBuilder().build(this.request.filters)} f-%04d.tif`; await Process.spawn(cmd, stdin, { cwd: config.tempDirectory }); files = (await this.listFiles()).filter(f => f.name.match(/f-\d{4}\.tif/)); } - const stdin = files.map(f => f.name).join('\n'); + const stdin = files.map(f => `${f.name}\n`).join(''); log.debug('Executing cmds:', this.pipeline.commands); const stdout = await Process.chain(this.pipeline.commands, stdin, { cwd: config.tempDirectory }); let filenames = stdout.toString().split('\n').filter(f => f.length > 0);