caroushell 0.1.17 → 0.1.18
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.
- package/dist/spawner.js +6 -4
- package/package.json +1 -1
package/dist/spawner.js
CHANGED
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runUserCommand = runUserCommand;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const process_1 = require("process");
|
|
6
|
+
const logs_1 = require("./logs");
|
|
6
7
|
const isWin = process.platform === "win32";
|
|
7
8
|
const shellBinary = isWin ? "cmd.exe" : "/bin/bash";
|
|
8
|
-
const shellArgs = isWin ? ["/c"] : ["-lc"];
|
|
9
|
+
const shellArgs = isWin ? ["/d", "/s", "/c"] : ["-lc"];
|
|
9
10
|
const builtInCommands = {
|
|
10
11
|
cd: async (args) => {
|
|
11
12
|
if (args.length === 1) {
|
|
@@ -47,6 +48,7 @@ function expandVars(input) {
|
|
|
47
48
|
return out;
|
|
48
49
|
}
|
|
49
50
|
async function runUserCommand(command) {
|
|
51
|
+
(0, logs_1.logLine)(`Running command: ${command}`);
|
|
50
52
|
const trimmed = command.trim();
|
|
51
53
|
if (!trimmed)
|
|
52
54
|
return false;
|
|
@@ -54,11 +56,11 @@ async function runUserCommand(command) {
|
|
|
54
56
|
if (typeof args[0] === "string" && builtInCommands[args[0]]) {
|
|
55
57
|
return await builtInCommands[args[0]](args);
|
|
56
58
|
}
|
|
57
|
-
// "
|
|
58
|
-
// \"
|
|
59
|
+
// "windowsVerbatimArguments: true" to prevent the bug of `echo "asdf"` outputting
|
|
60
|
+
// \"asdf\" instead of "asdf". I wonder why node defaults to quoting args on windows.
|
|
59
61
|
const proc = (0, child_process_1.spawn)(shellBinary, [...shellArgs, command], {
|
|
60
62
|
stdio: "inherit",
|
|
61
|
-
|
|
63
|
+
windowsVerbatimArguments: true,
|
|
62
64
|
});
|
|
63
65
|
await new Promise((resolve, reject) => {
|
|
64
66
|
proc.on("error", reject);
|