Skip to content

Commit 966b863

Browse files
committed
add pm2 fixes, upgrade pm2
1 parent ea622b9 commit 966b863

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/monitor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"cross-spawn": "^7.0.3",
3535
"neverthrow": "^8.1.1",
3636
"node-window-manager": "^2.2.4",
37-
"pm2": "^5.1.2",
37+
"pm2": "^5.4.3",
3838
"semver": "^7.3.5",
3939
"tail": "^2.2.4",
4040
"zod": "^3.23.8"

packages/monitor/src/core/process-manager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class ProcessManager {
3636
}
3737

3838
getProcesses(): ResultAsync<pm2.ProcessDescription[], Error> {
39-
return wrapPm2Function("Failed to get PM2 processes", pm2.list);
39+
return wrapPm2Function("Failed to get PM2 processes", (cb) => pm2.list(cb));
4040
}
4141

4242
startProcess(options: pm2.StartOptions): ResultAsync<pm2.ProcessDescription, Error> {
@@ -86,8 +86,10 @@ function wrapPm2Function<T>(
8686
}
8787

8888
const safeDisconnect = Result.fromThrowable(
89-
pm2.disconnect,
90-
(error) => new Error("Failed to disconnect from PM2", { cause: error }),
89+
() => pm2.disconnect(),
90+
(error) => {
91+
return new Error("Failed to disconnect from PM2", { cause: error })
92+
},
9193
);
9294

9395
function pingDaemon(): ResultAsync<boolean, Error> {

packages/monitor/src/monitor-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export const monitorConfigSchema = z.object({
134134
/** Set this to true to delete existing PM2 processes before connecting. If you're running volatile apps or your node process might be quit unexpectedly, this can be helpful to start with a clean slate on startup. */
135135
deleteExistingBeforeConnect: z
136136
.boolean()
137-
.default(false)
137+
.default(true)
138138
.describe(
139139
"Set this to true to delete existing PM2 processes before connecting. If you're running volatile apps or your node process might be quit unexpectedly, this can be helpful to start with a clean slate on startup.",
140140
),

0 commit comments

Comments
 (0)