ramm 0.0.20 → 0.0.22
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/ramm.js +21 -4
- package/dist/types/base.d.ts +5 -2
- package/package.json +1 -1
- package/dist/a.js +0 -3
package/dist/ramm.js
CHANGED
|
@@ -62,6 +62,19 @@ var tee = async (read) => {
|
|
|
62
62
|
process.stdout.write(value);
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
+
var teeErr = async (read) => {
|
|
66
|
+
const reader = read.getReader();
|
|
67
|
+
let output = "";
|
|
68
|
+
while (true) {
|
|
69
|
+
const { value, done: doneReading } = await reader.read();
|
|
70
|
+
if (doneReading) {
|
|
71
|
+
return output;
|
|
72
|
+
}
|
|
73
|
+
const decoder = new TextDecoder("utf-8");
|
|
74
|
+
output += decoder.decode(value);
|
|
75
|
+
process.stderr.write(value);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
65
78
|
var readStreamToStr = async (read) => {
|
|
66
79
|
const reader = read.getReader();
|
|
67
80
|
let output = "";
|
|
@@ -79,11 +92,15 @@ var execCommand = async (command) => {
|
|
|
79
92
|
const result = spawn(["bash", "-c", command], {
|
|
80
93
|
stdin: "inherit",
|
|
81
94
|
stdout: "pipe",
|
|
82
|
-
stderr: "
|
|
95
|
+
stderr: "pipe"
|
|
83
96
|
});
|
|
84
|
-
const output = await
|
|
97
|
+
const [output, outputErr] = await Promise.all([
|
|
98
|
+
tee(result.stdout),
|
|
99
|
+
teeErr(result.stderr)
|
|
100
|
+
]);
|
|
85
101
|
await result.exited;
|
|
86
102
|
return {
|
|
103
|
+
outputErr,
|
|
87
104
|
output,
|
|
88
105
|
spawnResult: result
|
|
89
106
|
};
|
|
@@ -126,8 +143,8 @@ var installSystemPackage = async (packageName) => {
|
|
|
126
143
|
// src/systemd.ts
|
|
127
144
|
var systemctlWordLangth = "systemctl ".length;
|
|
128
145
|
var formatUserspace = (context, command) => {
|
|
129
|
-
const userPart = context.userspace ? "--user" : "";
|
|
130
|
-
return
|
|
146
|
+
const userPart = context.userspace ? " --user " : "";
|
|
147
|
+
return "systemctl" + userPart + " " + command.slice(systemctlWordLangth);
|
|
131
148
|
};
|
|
132
149
|
var getSysyemdServiceName = (name) => {
|
|
133
150
|
return `${name}.service`;
|
package/dist/types/base.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Context } from "./context.ts";
|
|
2
2
|
export declare const defaultContext: Context;
|
|
3
|
+
export declare const teeErr: (read: ReadableStream) => Promise<string>;
|
|
3
4
|
export declare const execCommand: (command: string) => Promise<{
|
|
5
|
+
outputErr: string;
|
|
4
6
|
output: string;
|
|
5
|
-
spawnResult: import("bun").Subprocess<"inherit", "pipe", "
|
|
7
|
+
spawnResult: import("bun").Subprocess<"inherit", "pipe", "pipe">;
|
|
6
8
|
}>;
|
|
7
9
|
export declare const execCommandSilent: (command: string) => Promise<{
|
|
8
10
|
output: string;
|
|
@@ -10,6 +12,7 @@ export declare const execCommandSilent: (command: string) => Promise<{
|
|
|
10
12
|
}>;
|
|
11
13
|
export declare const copyFilesBySsh: (from: string, to: string, context: Context) => Promise<void>;
|
|
12
14
|
export declare const execBySsh: (command: string, context: Context) => Promise<{
|
|
15
|
+
outputErr: string;
|
|
13
16
|
output: string;
|
|
14
|
-
spawnResult: import("bun").Subprocess<"inherit", "pipe", "
|
|
17
|
+
spawnResult: import("bun").Subprocess<"inherit", "pipe", "pipe">;
|
|
15
18
|
}>;
|
package/package.json
CHANGED
package/dist/a.js
DELETED