plugins: install now preserves 'x' attribute

Massimo Melina committed Mar 14, 2026 at 16:43 UTC c09d0a2349877b75db3bf82cb71a3439ac8bb403
1 file changed +6 -2
src/util-files.ts
+6 -2
@@ -1,6 +1,6 @@
1 // This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3 -import { access, mkdir, readFile, stat } from 'fs/promises'
3 +import { access, chmod, mkdir, readFile, stat } from 'fs/promises'
4 import { Promisable, try_, wait, isWindowsDrive, haveTimeout } from './cross'
5 import { defineConfig } from './config'
6 import { createWriteStream, mkdirSync, watch, ftruncate } from 'fs'
@@ -94,7 +94,7 @@ export function escapeGlobPath(path: string) {
94 export async function unzip(stream: Readable, cb: (path: string) => Promisable<false | string>) {
95 let chain: Promise<any> = Promise.resolve()
96 return new Promise((resolve, reject) =>
97 - stream.pipe(unzipper.Parse())
97 + stream.pipe(unzipper.Extract())
98 .on('end', () => chain.then(resolve))
99 .on('error', reject)
100 .on('entry', (entry: any) =>
@@ -107,6 +107,10 @@ export async function unzip(stream: Readable, cb: (path: string) => Promisable<f
107 const thisFile = entry.pipe(await createSafeWriteStream(dest))
108 await finished(thisFile)
109 }) )
110 + .on('entryInCentral', (entry: any) => {
111 + if (entry.unixAttrs)
112 + chmod(entry.path, entry.unixAttrs)
113 + })
114 )
115 }
116