uni-run 1.1.22 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- export declare function getUniqueCacheDir(slug: string): string;
1
+ export declare function getOutputFileName(slug: string): string;
2
2
  export declare function getCacheDir(): string;
3
3
  export declare function cleanCacheDir(): void;
@@ -3,14 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getUniqueCacheDir = getUniqueCacheDir;
6
+ exports.getOutputFileName = getOutputFileName;
7
7
  exports.getCacheDir = getCacheDir;
8
8
  exports.cleanCacheDir = cleanCacheDir;
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const utils_1 = require("../helpers/utils");
11
11
  const cacheDir = path_1.default.join(__dirname, '../../.cache');
12
- function getUniqueCacheDir(slug) {
13
- return (0, utils_1.emptyDir)(cacheDir, slug + '-' + `${process.pid}-${process.ppid}`);
12
+ function getOutputFileName(slug) {
13
+ const ext = process.platform === 'win32' ? '.exe' : '';
14
+ const dir = (0, utils_1.emptyDir)(cacheDir, slug + '-' + `${process.pid}-${process.ppid}`);
15
+ return path_1.default.join(dir, 'output' + ext);
14
16
  }
15
17
  function getCacheDir() {
16
18
  return cacheDir;
@@ -231,7 +231,7 @@ exports.default = (0, as_1.default)([
231
231
  name: 'C - GCC',
232
232
  exts: ['c'],
233
233
  getRuntime([script, ...args], options, config) {
234
- const output = (0, helpers_1.getUniqueCacheDir)('/c-gcc') + '/output';
234
+ const output = (0, helpers_1.getOutputFileName)('/c-gcc');
235
235
  return {
236
236
  compile: ['gcc', script, '-o', output],
237
237
  exec: [output, ...args],
@@ -243,7 +243,7 @@ exports.default = (0, as_1.default)([
243
243
  name: 'C++ - GCC',
244
244
  exts: ['cpp'],
245
245
  getRuntime([script, ...args], options, config) {
246
- const output = (0, helpers_1.getUniqueCacheDir)('/cpp-gcc') + '/output';
246
+ const output = (0, helpers_1.getOutputFileName)('/cpp-gcc');
247
247
  return {
248
248
  compile: ['g++', script, '-o', output],
249
249
  exec: [output, ...args],
@@ -255,7 +255,7 @@ exports.default = (0, as_1.default)([
255
255
  name: 'C# - Mono (Windows)',
256
256
  exts: ['cs'],
257
257
  getRuntime([script, ...args], options, config) {
258
- const output = (0, helpers_1.getUniqueCacheDir)('/cs-mono') + '/output.exe';
258
+ const output = (0, helpers_1.getOutputFileName)('/cs-mono');
259
259
  return {
260
260
  compile: ['mcs', '-out:' + output, script],
261
261
  exec: [output, ...args],
@@ -267,7 +267,7 @@ exports.default = (0, as_1.default)([
267
267
  name: 'Rust - rustc',
268
268
  exts: ['rs'],
269
269
  getRuntime([script, ...args], options, config) {
270
- const output = (0, helpers_1.getUniqueCacheDir)('/rust-rustc') + '/output';
270
+ const output = (0, helpers_1.getOutputFileName)('/rust-rustc');
271
271
  return {
272
272
  compile: ['rustc', script, '-o', output],
273
273
  exec: [output, ...args],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-run",
3
- "version": "1.1.22",
3
+ "version": "1.1.23",
4
4
  "description": "Universal Runner for many language",
5
5
  "type": "commonjs",
6
6
  "scripts": {