uni-run 0.0.0 → 0.0.2

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.
@@ -14,7 +14,7 @@ class ExecutionBin {
14
14
  return this.extensions.has(script.split('.').pop() || '');
15
15
  }
16
16
  isInstalled() {
17
- const result = (0, cross_spawn_1.sync)(this.command, this.checkInstallationArgs ? this.checkInstallationArgs : []);
17
+ const result = (0, cross_spawn_1.sync)(this.command, this.checkInstallationArgs ? this.checkInstallationArgs : [], { shell: false, stdio: 'ignore' });
18
18
  if (result.status === 1)
19
19
  return false;
20
20
  return true;
package/dist/execute.js CHANGED
@@ -12,10 +12,11 @@ function default_1([command, ...args], options) {
12
12
  (_b = (_a = process.stdin).setRawMode) === null || _b === void 0 ? void 0 : _b.call(_a, true);
13
13
  process.stdin.on('keypress', (_, key) => {
14
14
  if (key.name === 'f5')
15
- return exec();
15
+ return runProcess();
16
16
  if ((key.ctrl || key.meta) && key.name === 'r')
17
- return exec();
17
+ return runProcess();
18
18
  if (key.ctrl && key.name === 'c') {
19
+ killProcess();
19
20
  console.log('^C...');
20
21
  process.exit(0);
21
22
  }
@@ -26,20 +27,17 @@ function default_1([command, ...args], options) {
26
27
  ignore: options.watchIgnore,
27
28
  debounceDelay: options.watchDelay,
28
29
  extensions: new Set(options.watchExtensions),
29
- }, () => exec());
30
+ }, () => runProcess());
30
31
  }
31
32
  let child = null;
32
- function exec() {
33
+ function runProcess() {
33
34
  if (options.clearOnReload) {
34
35
  process.stdout.write('\x1Bc');
35
36
  console.clear();
36
37
  }
37
- if (child) {
38
- child.removeAllListeners();
39
- child.kill();
40
- }
38
+ killProcess();
41
39
  child = (0, cross_spawn_1.spawn)(command, args, {
42
- argv0: command,
40
+ shell: false,
43
41
  cwd: options.cwd,
44
42
  stdio: 'inherit',
45
43
  env: Object.assign({}, options.env),
@@ -55,5 +53,14 @@ function default_1([command, ...args], options) {
55
53
  }
56
54
  });
57
55
  }
58
- exec();
56
+ function killProcess() {
57
+ if (child) {
58
+ child.removeAllListeners();
59
+ child.kill();
60
+ }
61
+ }
62
+ runProcess();
63
+ process.on('exit', killProcess);
64
+ process.on('SIGINT', killProcess);
65
+ process.on('cleanup', killProcess);
59
66
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "uni-run",
3
3
  "description": "Universal Runner for many language",
4
- "version": "0.0.0",
4
+ "version": "0.0.2",
5
5
  "type": "commonjs",
6
6
  "scripts": {
7
7
  "ts": "w ./src/__lab__/index.ts",