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(pacmak): occasional EISDIR failure #948

Merged
merged 2 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion packages/jsii-pacmak/lib/packaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ export class JsiiModule {
// tarball name. otherwise, there can be a lot of extra noise there
// from scripts that emit to STDOUT.
const lines = out.trim().split(os.EOL);
return path.resolve(tmpdir, lines[lines.length - 1].trim());
const lastLine = lines[lines.length - 1].trim();

if (!lastLine.endsWith('.tgz') && !lastLine.endsWith('.tar.gz')) {
throw new Error(`npm pack did not produce tarball from ${this.moduleDirectory} into ${tmpdir} (output was ${JSON.stringify(lines)})`);
}

return path.resolve(tmpdir, lastLine);
});
}

Expand Down
5 changes: 4 additions & 1 deletion packages/jsii-pacmak/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export async function shell(cmd: string, args: string[], options: ShellOptions):
stderr.push(Buffer.from(chunk));
});
child.once('error', ko);
child.once('exit', (code, signal) => {

// Must use CLOSE instead of EXIT; EXIT may fire while there is still data in the
// I/O pipes, which we will miss if we return at that point.
child.once('close', (code, signal) => {
const out = Buffer.concat(stdout).toString('utf-8');
if (code === 0) { return ok(out); }
const err = Buffer.concat(stderr).toString('utf-8');
Expand Down