Within a custom publisher, a promise-based zip function does not complete
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 641
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 30
Description
### Pre-flight checklist
- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.
### Forge version
7.5.0
### Electron version
24.1.1
### Operating system
macOS 11.3
### Last known working Forge version
_No response_
### Expected behavior
The function below is called in the `publish` method of our custom publisher (using `await`):
```async function zipDirectory(sourceDir, outPath) {
const archiver = require('archiver');
const archive = archiver('zip');
const stream = createWriteStream(outPath);
return new Promise((resolve, reject) => {
archive
.directory(sourceDir, false)
.on('error', err => reject(err))
.pipe(stream);
stream.on('close', () => {
Log.debug(`App zipped: ${outPath} (${(archive.pointer()/1024/1024).toFixed(2)})MB`)
resolve()
});
archive.finalize();
});
}
```
But where it worked before inside of a postMake hook in forge.config.js, it doesn't work in this publisher. It just times out.
### Actual behavior
The function `zipDirectory` above never returns.
### Steps to reproduce
As posted above
### Additional information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.