Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: server untar pkg error when tgz with large amount of warning mes… #242

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: server untar pkg error when tgz with large amount of warning mes…
…sages, which will cause stderr buffer overflow
  • Loading branch information
jianxun.zxl committed Jan 17, 2024
commit 975308a25c38b0df58f0ed95862744ce79056813
14 changes: 11 additions & 3 deletions common/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,19 @@
done(err);
}
if (cmdTar) {
childProcess.exec(`tar xfz ${file}`, {
console.log(`[untar]: tar xfz ${file}`);
let ut = childProcess.spawn('tar', ['xfz', file, '--warning=no-unknown-keyword'], {
cwd: cwd
}, (error) => {
cb(error);
});
ut.stdout.on('data', (data) => {
console.log(`[untar stdout]: ${data}`);

Check warning on line 384 in common/utils.js

View check run for this annotation

Codecov / codecov/patch

common/utils.js#L384

Added line #L384 was not covered by tests
});
// 监听标准错误输出
ut.stderr.on('data', (data) => {
console.error(`[untar stderr]: ${data}`);

Check warning on line 388 in common/utils.js

View check run for this annotation

Codecov / codecov/patch

common/utils.js#L388

Added line #L388 was not covered by tests
});
ut.on('error', cb);
ut.on('close', cb);
} else {
let pkgStream;
if (fs.existsSync(path.join(cwd, file))) {
Expand Down
Loading