Skip to content

Commit

Permalink
fix(kernel): can't find temp directory on Windows (#184)
Browse files Browse the repository at this point in the history
Use `os.tmpdir()` instead of `/tmp` when creating
the kernel installation and staging directories.

Fixes #183
  • Loading branch information
Elad Ben-Israel authored Aug 16, 2018
1 parent afb4d2e commit 1aec545
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/jsii-kernel/lib/kernel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'fs-extra';
import * as spec from 'jsii-spec';
import * as os from 'os';
import * as path from 'path';
import { SourceMapConsumer } from 'source-map';
import * as tar from 'tar';
Expand Down Expand Up @@ -73,7 +74,7 @@ export class Kernel {
}

if (!this.installDir) {
this.installDir = await fs.mkdtemp('/tmp/jsii-kernel-');
this.installDir = await fs.mkdtemp(path.join(os.tmpdir(), 'jsii-kernel-'));
await fs.mkdirp(path.join(this.installDir, 'node_modules'));
this._debug('creating jsii-kernel modules workdir:', this.installDir);

Expand Down Expand Up @@ -110,7 +111,7 @@ export class Kernel {
} else {
// untar the archive to a staging directory, read the jsii spec from it
// and then move it to the node_modules directory of the kernel.
const staging = await fs.mkdtemp('/tmp/jsii-kernel-install-staging-');
const staging = await fs.mkdtemp(path.join(os.tmpdir(), 'jsii-kernel-install-staging-'));
try {
await tar.extract({ strict: true, file: req.tarball, cwd: staging });

Expand Down

0 comments on commit 1aec545

Please sign in to comment.