@carrieros/cli 0.1.0 → 0.3.0
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/README.md +142 -57
- package/dist/commands/attach.js +45 -0
- package/dist/commands/auth.js +60 -0
- package/dist/commands/btw.js +78 -0
- package/dist/commands/changes.js +167 -0
- package/dist/commands/chat.js +102 -13
- package/dist/commands/context.js +160 -0
- package/dist/commands/doctor.js +53 -8
- package/dist/commands/files.js +84 -23
- package/dist/commands/help.js +3 -1
- package/dist/commands/history.js +88 -23
- package/dist/commands/login.js +44 -41
- package/dist/commands/logout.js +13 -4
- package/dist/commands/memory.js +162 -0
- package/dist/commands/mode-model.js +39 -3
- package/dist/commands/modes.js +4 -1
- package/dist/commands/project.js +106 -0
- package/dist/commands/repo.js +146 -0
- package/dist/commands/repos.js +61 -0
- package/dist/commands/review.js +92 -0
- package/dist/commands/scope.js +152 -0
- package/dist/commands/search.js +92 -0
- package/dist/commands/sessions.js +219 -65
- package/dist/commands/settings.js +87 -0
- package/dist/commands/update.js +159 -0
- package/dist/commands/upload.js +204 -31
- package/dist/commands/usage.js +212 -16
- package/dist/commands/whoami.js +2 -1
- package/dist/ide/editor-context.js +172 -0
- package/dist/ide/ide-session.js +94 -0
- package/dist/ide/tool-host.js +109 -0
- package/dist/main.js +30 -1
- package/dist/services/api.js +171 -13
- package/dist/services/chat-stream.js +145 -0
- package/dist/services/checkpoints.js +116 -0
- package/dist/services/client-tools.js +260 -0
- package/dist/services/command-coordinator.js +200 -0
- package/dist/services/command-policy.js +404 -0
- package/dist/services/config.js +249 -22
- package/dist/services/context.js +307 -6
- package/dist/services/device-auth.js +261 -0
- package/dist/services/diff.js +196 -0
- package/dist/services/env-policy.js +108 -0
- package/dist/services/file-detect.js +104 -0
- package/dist/services/file-resolver.js +199 -0
- package/dist/services/file-upload.js +126 -0
- package/dist/services/git-tools.js +248 -0
- package/dist/services/glob-match.js +164 -0
- package/dist/services/helper-bin.js +64 -0
- package/dist/services/ignore-rules.js +189 -0
- package/dist/services/job-helper.js +307 -0
- package/dist/services/local-files.js +517 -0
- package/dist/services/local-tools.js +432 -0
- package/dist/services/login-flow.js +120 -10
- package/dist/services/meta.js +3 -1
- package/dist/services/mutation-coordinator.js +161 -0
- package/dist/services/mutations.js +493 -0
- package/dist/services/open-url.js +68 -0
- package/dist/services/output.js +13 -5
- package/dist/services/packaged.js +24 -0
- package/dist/services/process-runner.js +406 -0
- package/dist/services/project-context.js +298 -0
- package/dist/services/redaction.js +201 -0
- package/dist/services/secure-store.js +197 -0
- package/dist/services/session-resolver.js +108 -0
- package/dist/services/sia.js +51 -0
- package/dist/services/spinner.js +23 -1
- package/dist/services/update.js +286 -0
- package/dist/services/workspace-registry.js +309 -0
- package/dist/services/workspace.js +573 -0
- package/dist/shell/shell-chat.js +1115 -59
- package/dist/shell/shell-commands.js +220 -19
- package/dist/shell/shell-prompt.js +89 -37
- package/dist/shell/shell-renderer.js +19 -38
- package/dist/shell/shell-router.js +19 -3
- package/dist/shell/shell.js +232 -44
- package/dist/types/index.js +3 -1
- package/dist/ui/approval.js +81 -0
- package/dist/ui/banner.js +55 -13
- package/dist/ui/btw-overlay.js +230 -0
- package/dist/ui/change-review.js +87 -0
- package/dist/ui/chat-renderer.js +223 -29
- package/dist/ui/color-picker.js +21 -0
- package/dist/ui/colors.js +9 -1
- package/dist/ui/command-filter.js +40 -5
- package/dist/ui/command-palette.js +122 -62
- package/dist/ui/command-registry.js +85 -11
- package/dist/ui/command-review.js +138 -0
- package/dist/ui/composer-layout.js +41 -0
- package/dist/ui/conversation.js +398 -0
- package/dist/ui/interrupt.js +35 -0
- package/dist/ui/live.js +18 -1
- package/dist/ui/markdown.js +63 -9
- package/dist/ui/message.js +14 -31
- package/dist/ui/screen-prompt.js +181 -0
- package/dist/ui/screen.js +289 -0
- package/dist/ui/select.js +193 -29
- package/dist/ui/sia-qa.js +213 -0
- package/dist/ui/text-prompt.js +74 -0
- package/dist/ui/theme.js +17 -0
- package/dist/ui/trust.js +93 -0
- package/dist/ui/ui.js +4 -1
- package/package.json +17 -6
- package/dist/ui/activity.js +0 -77
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { ConfigStore } from "./config.js";
|
|
6
|
+
import { findPrebuiltHelper } from "./helper-bin.js";
|
|
7
|
+
/**
|
|
8
|
+
* The Windows process-containment helper.
|
|
9
|
+
*
|
|
10
|
+
* Node has no API for Job Objects, and without one a cancelled or timed-out
|
|
11
|
+
* command leaves its grandchildren running: measured on this CLI's target
|
|
12
|
+
* platform, `child.kill()`, a spawnSync timeout and the CLI exiting all left a
|
|
13
|
+
* `cmd -> ping` grandchild alive, and `taskkill /T` misses anything whose
|
|
14
|
+
* parent already exited.
|
|
15
|
+
*
|
|
16
|
+
* So commands start through this tiny launcher. It creates a Job Object with
|
|
17
|
+
* KILL_ON_JOB_CLOSE and NO breakaway, starts the program suspended, assigns it,
|
|
18
|
+
* then resumes it — nothing it starts can escape. The launcher holds the only
|
|
19
|
+
* job handle, and Node's own job kills the launcher when the CLI dies, so every
|
|
20
|
+
* way the CLI or the command ends takes the whole tree with it.
|
|
21
|
+
*
|
|
22
|
+
* The source is below and compiled on first use with the C# compiler that ships
|
|
23
|
+
* with Windows (.NET Framework 4.x, `csc.exe`) — no binary is downloaded or
|
|
24
|
+
* bundled. The result is cached per source hash in the CLI's LOCAL app data and
|
|
25
|
+
* its hash is checked before every use. That check catches corruption and a
|
|
26
|
+
* stale build; it is NOT a defence against other code running as the same
|
|
27
|
+
* user, which could replace any file this user can write.
|
|
28
|
+
*/
|
|
29
|
+
export const JOB_HELPER_FAILURE_EXIT = 32431;
|
|
30
|
+
export const JOB_HELPER_SOURCE = String.raw `using System;
|
|
31
|
+
using System.ComponentModel;
|
|
32
|
+
using System.Runtime.InteropServices;
|
|
33
|
+
using System.Text;
|
|
34
|
+
|
|
35
|
+
// cos-job-runner: start ONE program inside a Windows Job Object that kills
|
|
36
|
+
// every process in it when the job's last handle closes. This process holds the
|
|
37
|
+
// only handle, so however it ends — normal exit, TerminateProcess, or its own
|
|
38
|
+
// parent dying — the whole tree it started ends with it.
|
|
39
|
+
//
|
|
40
|
+
// Usage: cos-job-runner.exe <absolute-program-path> [args...]
|
|
41
|
+
// The program is started SUSPENDED, assigned to the job, then resumed, so no
|
|
42
|
+
// descendant can be created outside the job. No shell is involved: the argv is
|
|
43
|
+
// re-quoted with the MSVC rules and passed to CreateProcess with the program
|
|
44
|
+
// path as lpApplicationName (no search).
|
|
45
|
+
static class CosJobRunner
|
|
46
|
+
{
|
|
47
|
+
const int HelperFailure = 32431;
|
|
48
|
+
|
|
49
|
+
[StructLayout(LayoutKind.Sequential)]
|
|
50
|
+
struct JOBOBJECT_BASIC_LIMIT_INFORMATION
|
|
51
|
+
{
|
|
52
|
+
public long PerProcessUserTimeLimit;
|
|
53
|
+
public long PerJobUserTimeLimit;
|
|
54
|
+
public uint LimitFlags;
|
|
55
|
+
public UIntPtr MinimumWorkingSetSize;
|
|
56
|
+
public UIntPtr MaximumWorkingSetSize;
|
|
57
|
+
public uint ActiveProcessLimit;
|
|
58
|
+
public UIntPtr Affinity;
|
|
59
|
+
public uint PriorityClass;
|
|
60
|
+
public uint SchedulingClass;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[StructLayout(LayoutKind.Sequential)]
|
|
64
|
+
struct IO_COUNTERS
|
|
65
|
+
{
|
|
66
|
+
public ulong ReadOperationCount, WriteOperationCount, OtherOperationCount;
|
|
67
|
+
public ulong ReadTransferCount, WriteTransferCount, OtherTransferCount;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[StructLayout(LayoutKind.Sequential)]
|
|
71
|
+
struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION
|
|
72
|
+
{
|
|
73
|
+
public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
|
|
74
|
+
public IO_COUNTERS IoInfo;
|
|
75
|
+
public UIntPtr ProcessMemoryLimit;
|
|
76
|
+
public UIntPtr JobMemoryLimit;
|
|
77
|
+
public UIntPtr PeakProcessMemoryUsed;
|
|
78
|
+
public UIntPtr PeakJobMemoryUsed;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
|
82
|
+
struct STARTUPINFO
|
|
83
|
+
{
|
|
84
|
+
public int cb;
|
|
85
|
+
public string lpReserved, lpDesktop, lpTitle;
|
|
86
|
+
public int dwX, dwY, dwXSize, dwYSize, dwXCountChars, dwYCountChars, dwFillAttribute, dwFlags;
|
|
87
|
+
public short wShowWindow, cbReserved2;
|
|
88
|
+
public IntPtr lpReserved2, hStdInput, hStdOutput, hStdError;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
[StructLayout(LayoutKind.Sequential)]
|
|
92
|
+
struct PROCESS_INFORMATION
|
|
93
|
+
{
|
|
94
|
+
public IntPtr hProcess, hThread;
|
|
95
|
+
public int dwProcessId, dwThreadId;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
|
99
|
+
static extern IntPtr CreateJobObjectW(IntPtr attributes, string name);
|
|
100
|
+
|
|
101
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
102
|
+
static extern bool SetInformationJobObject(IntPtr job, int infoClass, ref JOBOBJECT_EXTENDED_LIMIT_INFORMATION info, uint length);
|
|
103
|
+
|
|
104
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
105
|
+
static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process);
|
|
106
|
+
|
|
107
|
+
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
|
108
|
+
static extern bool CreateProcessW(string app, StringBuilder cmdLine, IntPtr procAttr, IntPtr threadAttr,
|
|
109
|
+
bool inheritHandles, uint flags, IntPtr env, string cwd, ref STARTUPINFO si, out PROCESS_INFORMATION pi);
|
|
110
|
+
|
|
111
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
112
|
+
static extern uint ResumeThread(IntPtr thread);
|
|
113
|
+
|
|
114
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
115
|
+
static extern bool TerminateProcess(IntPtr process, uint code);
|
|
116
|
+
|
|
117
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
118
|
+
static extern bool TerminateJobObject(IntPtr job, uint code);
|
|
119
|
+
|
|
120
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
121
|
+
static extern uint WaitForSingleObject(IntPtr handle, uint ms);
|
|
122
|
+
|
|
123
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
124
|
+
static extern bool GetExitCodeProcess(IntPtr process, out uint code);
|
|
125
|
+
|
|
126
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
127
|
+
static extern IntPtr GetStdHandle(int which);
|
|
128
|
+
|
|
129
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
130
|
+
static extern bool CloseHandle(IntPtr handle);
|
|
131
|
+
|
|
132
|
+
const int JobObjectExtendedLimitInformation = 9;
|
|
133
|
+
const uint JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x2000;
|
|
134
|
+
const uint JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x400;
|
|
135
|
+
const uint CREATE_SUSPENDED = 0x4;
|
|
136
|
+
const uint CREATE_NO_WINDOW = 0x08000000;
|
|
137
|
+
const int STARTF_USESTDHANDLES = 0x100;
|
|
138
|
+
const uint INFINITE = 0xFFFFFFFF;
|
|
139
|
+
|
|
140
|
+
static int Fail(string what)
|
|
141
|
+
{
|
|
142
|
+
Console.Error.WriteLine("cos-job-runner: " + what + ": " + new Win32Exception(Marshal.GetLastWin32Error()).Message);
|
|
143
|
+
return HelperFailure;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// MSVC / CommandLineToArgvW quoting, so the child sees exactly these args.
|
|
147
|
+
static string Quote(string arg)
|
|
148
|
+
{
|
|
149
|
+
if (arg.Length > 0 && arg.IndexOfAny(new[] { ' ', '\t', '\n', '\v', '"' }) < 0) return arg;
|
|
150
|
+
var sb = new StringBuilder("\"");
|
|
151
|
+
for (int i = 0; ; i++)
|
|
152
|
+
{
|
|
153
|
+
int slashes = 0;
|
|
154
|
+
while (i < arg.Length && arg[i] == '\\') { slashes++; i++; }
|
|
155
|
+
if (i == arg.Length) { sb.Append('\\', slashes * 2); break; }
|
|
156
|
+
if (arg[i] == '"') { sb.Append('\\', slashes * 2 + 1); sb.Append('"'); }
|
|
157
|
+
else { sb.Append('\\', slashes); sb.Append(arg[i]); }
|
|
158
|
+
}
|
|
159
|
+
sb.Append('"');
|
|
160
|
+
return sb.ToString();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
static int Main(string[] argv)
|
|
164
|
+
{
|
|
165
|
+
if (argv.Length < 1 || !System.IO.Path.IsPathRooted(argv[0]))
|
|
166
|
+
{
|
|
167
|
+
Console.Error.WriteLine("cos-job-runner: an absolute program path is required");
|
|
168
|
+
return HelperFailure;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
IntPtr job = CreateJobObjectW(IntPtr.Zero, null);
|
|
172
|
+
if (job == IntPtr.Zero) return Fail("CreateJobObject");
|
|
173
|
+
|
|
174
|
+
var limits = new JOBOBJECT_EXTENDED_LIMIT_INFORMATION();
|
|
175
|
+
// No BREAKAWAY_OK flags: nothing started inside may leave the job.
|
|
176
|
+
limits.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION;
|
|
177
|
+
if (!SetInformationJobObject(job, JobObjectExtendedLimitInformation, ref limits, (uint)Marshal.SizeOf(limits)))
|
|
178
|
+
return Fail("SetInformationJobObject");
|
|
179
|
+
|
|
180
|
+
var cmd = new StringBuilder();
|
|
181
|
+
for (int i = 0; i < argv.Length; i++)
|
|
182
|
+
{
|
|
183
|
+
if (i > 0) cmd.Append(' ');
|
|
184
|
+
cmd.Append(Quote(argv[i]));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
var si = new STARTUPINFO();
|
|
188
|
+
si.cb = Marshal.SizeOf(si);
|
|
189
|
+
si.dwFlags = STARTF_USESTDHANDLES;
|
|
190
|
+
si.hStdInput = GetStdHandle(-10);
|
|
191
|
+
si.hStdOutput = GetStdHandle(-11);
|
|
192
|
+
si.hStdError = GetStdHandle(-12);
|
|
193
|
+
|
|
194
|
+
PROCESS_INFORMATION pi;
|
|
195
|
+
// CREATE_NO_WINDOW: a hidden console of its own — descendants never draw
|
|
196
|
+
// on, or receive Ctrl+C from, the user's terminal.
|
|
197
|
+
if (!CreateProcessW(argv[0], cmd, IntPtr.Zero, IntPtr.Zero, true, CREATE_SUSPENDED | CREATE_NO_WINDOW,
|
|
198
|
+
IntPtr.Zero, null, ref si, out pi))
|
|
199
|
+
return Fail("CreateProcess");
|
|
200
|
+
|
|
201
|
+
if (!AssignProcessToJobObject(job, pi.hProcess))
|
|
202
|
+
{
|
|
203
|
+
string reason = new Win32Exception(Marshal.GetLastWin32Error()).Message;
|
|
204
|
+
TerminateProcess(pi.hProcess, HelperFailure);
|
|
205
|
+
Console.Error.WriteLine("cos-job-runner: AssignProcessToJobObject: " + reason);
|
|
206
|
+
return HelperFailure;
|
|
207
|
+
}
|
|
208
|
+
ResumeThread(pi.hThread);
|
|
209
|
+
CloseHandle(pi.hThread);
|
|
210
|
+
|
|
211
|
+
WaitForSingleObject(pi.hProcess, INFINITE);
|
|
212
|
+
uint code;
|
|
213
|
+
GetExitCodeProcess(pi.hProcess, out code);
|
|
214
|
+
CloseHandle(pi.hProcess);
|
|
215
|
+
|
|
216
|
+
// Whatever the program left running dies with it.
|
|
217
|
+
TerminateJobObject(job, code);
|
|
218
|
+
CloseHandle(job);
|
|
219
|
+
return unchecked((int)code);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
`;
|
|
223
|
+
export class JobHelperError extends Error {
|
|
224
|
+
code;
|
|
225
|
+
constructor(code, message) {
|
|
226
|
+
super(message);
|
|
227
|
+
this.code = code;
|
|
228
|
+
this.name = "JobHelperError";
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const sha256 = (data) => crypto.createHash("sha256").update(data).digest("hex");
|
|
232
|
+
function helperDir() {
|
|
233
|
+
const local = process.env.LOCALAPPDATA;
|
|
234
|
+
return local ? path.join(local, "CarrierOS", "bin") : path.join(ConfigStore.resolveDir(), "bin");
|
|
235
|
+
}
|
|
236
|
+
/** The .NET Framework C# compiler, by absolute path under the Windows directory. */
|
|
237
|
+
function findCompiler() {
|
|
238
|
+
const windir = process.env.SystemRoot || process.env.windir || "C:\\Windows";
|
|
239
|
+
for (const fw of ["Framework64", "Framework"]) {
|
|
240
|
+
const csc = path.join(windir, "Microsoft.NET", fw, "v4.0.30319", "csc.exe");
|
|
241
|
+
if (fs.existsSync(csc))
|
|
242
|
+
return csc;
|
|
243
|
+
}
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
let verified = null;
|
|
247
|
+
/**
|
|
248
|
+
* Absolute path to a verified helper, compiling it if needed.
|
|
249
|
+
* Throws JobHelperError when containment cannot be provided — callers must then
|
|
250
|
+
* refuse to run the command rather than run it uncontained.
|
|
251
|
+
*/
|
|
252
|
+
export function ensureJobHelper() {
|
|
253
|
+
if (process.platform !== "win32") {
|
|
254
|
+
throw new JobHelperError("UNSUPPORTED_PLATFORM", "Command execution is only available on Windows for now.");
|
|
255
|
+
}
|
|
256
|
+
// Packaged builds ship the helper prebuilt beside the executable — no
|
|
257
|
+
// compiler, source or npm involved. Use it when present and intact.
|
|
258
|
+
const prebuilt = findPrebuiltHelper("cos-job-runner");
|
|
259
|
+
if (prebuilt) {
|
|
260
|
+
verified = prebuilt;
|
|
261
|
+
return prebuilt;
|
|
262
|
+
}
|
|
263
|
+
const tag = sha256(JOB_HELPER_SOURCE).slice(0, 16);
|
|
264
|
+
const dir = helperDir();
|
|
265
|
+
const exe = path.join(dir, `cos-job-runner-${tag}.exe`);
|
|
266
|
+
const stamp = `${exe}.sha256`;
|
|
267
|
+
if (verified === exe && fs.existsSync(exe))
|
|
268
|
+
return exe;
|
|
269
|
+
if (fs.existsSync(exe) && fs.existsSync(stamp)) {
|
|
270
|
+
if (sha256(fs.readFileSync(exe)) === fs.readFileSync(stamp, "utf8").trim()) {
|
|
271
|
+
verified = exe;
|
|
272
|
+
return exe;
|
|
273
|
+
}
|
|
274
|
+
// Corrupt or tampered: rebuild rather than run it.
|
|
275
|
+
fs.rmSync(exe, { force: true });
|
|
276
|
+
fs.rmSync(stamp, { force: true });
|
|
277
|
+
}
|
|
278
|
+
const csc = findCompiler();
|
|
279
|
+
if (!csc) {
|
|
280
|
+
throw new JobHelperError("HELPER_UNAVAILABLE", "The .NET Framework C# compiler was not found, so commands cannot be contained. Nothing was run.");
|
|
281
|
+
}
|
|
282
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
283
|
+
const nonce = crypto.randomBytes(6).toString("hex");
|
|
284
|
+
const srcFile = path.join(dir, `cos-job-runner-${tag}-${nonce}.cs`);
|
|
285
|
+
const tmpExe = path.join(dir, `cos-job-runner-${tag}-${nonce}.exe`);
|
|
286
|
+
fs.writeFileSync(srcFile, JOB_HELPER_SOURCE, "utf8");
|
|
287
|
+
try {
|
|
288
|
+
execFileSync(csc, ["/nologo", "/target:exe", "/optimize+", `/out:${tmpExe}`, srcFile], {
|
|
289
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
290
|
+
windowsHide: true,
|
|
291
|
+
timeout: 60_000
|
|
292
|
+
});
|
|
293
|
+
const hash = sha256(fs.readFileSync(tmpExe));
|
|
294
|
+
fs.renameSync(tmpExe, exe);
|
|
295
|
+
fs.writeFileSync(stamp, hash, "utf8");
|
|
296
|
+
}
|
|
297
|
+
catch (err) {
|
|
298
|
+
fs.rmSync(tmpExe, { force: true });
|
|
299
|
+
const out = String(err.stdout ?? "").slice(0, 400);
|
|
300
|
+
throw new JobHelperError("HELPER_UNAVAILABLE", `The command helper could not be built. Nothing was run. ${out}`.trim());
|
|
301
|
+
}
|
|
302
|
+
finally {
|
|
303
|
+
fs.rmSync(srcFile, { force: true });
|
|
304
|
+
}
|
|
305
|
+
verified = exe;
|
|
306
|
+
return exe;
|
|
307
|
+
}
|