You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Hydro/packages/hydrojudge/src/tmpfs.ts

17 lines
466 B
TypeScript

import child from 'child_process';
import fs from 'fs-extra';
import os from 'os';
import log from './log';
const linux = os.platform() === 'linux';
if (!linux) log.warn('Not running on linux. tmpfs disabled.');
export function mount(path: string, size = '32m') {
fs.ensureDirSync(path);
if (linux) child.execSync(`mount tmpfs ${path} -t tmpfs -o size=${size}`);
}
export function umount(path: string) {
if (linux) child.execSync(`umount ${path}`);
}