Skip to content

Commit 6047edb

Browse files
fix: use os.tmpdir() so install works on Termux (Android)
Hardcoded '/tmp' fails on Termux because Android doesn't expose /tmp; the writable temp is at $PREFIX/tmp (typically /data/data/com.termux/files/usr/tmp). os.tmpdir() respects $TMPDIR (Termux sets it) and falls back to the platform default everywhere else — no behavior change on Linux/macOS/Windows. Refs JavaScriptSolidServer/JavaScriptSolidServer#517 — JSS itself has the same bug in src/cli/install.js; not patched here (this is the jspod-side surface that's most user-facing).
1 parent 38e8a1e commit 6047edb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import chalk from 'chalk';
1212
import { existsSync, mkdirSync, readFileSync, writeFileSync, chmodSync, statSync, copyFileSync, cpSync, promises as fsPromises } from 'fs';
1313
import { randomBytes } from 'crypto';
1414
import { createServer } from 'net';
15+
import { tmpdir } from 'os';
1516

1617
const __dirname = dirname(fileURLToPath(import.meta.url));
1718
const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'));
@@ -118,7 +119,9 @@ async function runInstall(rest) {
118119
}
119120
const { source, name, ref } = spec;
120121
const dest = `${opts.pod}/public/apps/${name}`;
121-
const tmp = join('/tmp', `jspod-install-${name}-${process.pid}`);
122+
// Respect the platform's tmp dir — `/tmp` is hardcoded out on
123+
// Termux (Android), where the writable tmp is at $PREFIX/tmp.
124+
const tmp = join(tmpdir(), `jspod-install-${name}-${process.pid}`);
122125

123126
// Clean stale tmp from a previous failed run
124127
if (existsSync(tmp)) spawnSync('rm', ['-rf', tmp], { stdio: 'ignore' });

0 commit comments

Comments
 (0)