Skip to content

Commit a2cc8b4

Browse files
committed
Change spawn to cross-spawn
1 parent efda4b9 commit a2cc8b4

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

package.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{
22
"name": "@sa-mp/cli",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "Command Line Interface (CLI) for NodeSamp.",
5-
"keywords": ["nodesamp", "sa-mp", "samp", "cli"],
5+
"keywords": [
6+
"nodesamp",
7+
"sa-mp",
8+
"samp",
9+
"cli"
10+
],
611
"repository": "github:dev2alert/node-samp-cli",
712
"publishConfig": {
813
"access": "public"
@@ -14,25 +19,27 @@
1419
"scripts": {
1520
"start": "cross-env NODE_ENV=production node . -h",
1621
"compile": "tsc",
17-
"dev": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node . -h\"",
22+
"dev": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node . ../starter\"",
1823
"postinstall": "cross-env NODE_ENV=production node ./dist/install.js",
1924
"install-dev": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node ./dist/install.js\""
2025
},
2126
"author": "dev2alert",
2227
"license": "MIT",
2328
"devDependencies": {
29+
"@types/cross-spawn": "^6.0.2",
2430
"@types/download": "^8.0.1",
2531
"@types/mime": "^2.0.3",
2632
"@types/node": "^16.4.13",
2733
"tsc-watch": "^4.5.0",
2834
"typescript": "^4.4.4"
2935
},
3036
"dependencies": {
31-
"cross-env": "^7.0.3",
3237
"chalk": "^4.1.2",
3338
"class-transformer": "^0.4.0",
3439
"class-validator": "^0.13.1",
3540
"commander": "^8.3.0",
41+
"cross-env": "^7.0.3",
42+
"cross-spawn": "^7.0.3",
3643
"download": "^8.0.0",
3744
"extract-zip": "^2.0.1",
3845
"iconv-lite": "^0.6.3",

src/actions/root/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import "reflect-metadata";
22
import {program} from "commander";
33
import {unlink, writeFile} from "fs/promises";
44
import {join} from "path";
5-
import {spawn} from "child_process";
5+
import {spawn} from "cross-spawn";
66
import {Config, ConfigPathTypes, ConfigException} from "./config";
77
import * as logger from "../../logger";
88
import {ConfigParams} from "./config-params";
@@ -36,7 +36,8 @@ export class Root {
3636
else this.plugins = [];
3737
await this.config.createServerConfig();
3838
await this.createPluginConfig();
39-
spawn(process.platform === "win32" ? "./samp-server.exe" : "./samp03svr", {cwd: this.getServerPath(), stdio: "inherit"});
39+
const serverPath: string = this.getServerPath();
40+
spawn(process.platform === "win32" ? join(serverPath, "./samp-server.exe") : join(serverPath, "./samp03svr"), {cwd: serverPath, stdio: "inherit"});
4041
} catch(error) {
4142
if(error instanceof ConfigException)
4243
logger.config.error(error);

0 commit comments

Comments
 (0)