Skip to content

Commit 1aec545

Browse files
author
Elad Ben-Israel
authored
fix(kernel): can't find temp directory on Windows (#184)
Use `os.tmpdir()` instead of `/tmp` when creating the kernel installation and staging directories. Fixes #183
1 parent afb4d2e commit 1aec545

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/jsii-kernel/lib/kernel.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as fs from 'fs-extra';
22
import * as spec from 'jsii-spec';
3+
import * as os from 'os';
34
import * as path from 'path';
45
import { SourceMapConsumer } from 'source-map';
56
import * as tar from 'tar';
@@ -73,7 +74,7 @@ export class Kernel {
7374
}
7475

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

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

0 commit comments

Comments
 (0)