lark-relay 0.4.4 → 0.4.5

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.
Files changed (2) hide show
  1. package/lib/status.js +6 -1
  2. package/package.json +1 -1
package/lib/status.js CHANGED
@@ -47,7 +47,12 @@ const DISPATCH_LABEL_PREFIX = process.env.LR_DISPATCH_LABEL_PREFIX || 'com.adaex
47
47
 
48
48
  function launchctlState(label) {
49
49
  try {
50
- const out = execFileSync('launchctl', ['print', `system/${label}`], { encoding: 'utf8' })
50
+ // stderr 必须 ignore:launchctl 对不存在的服务把 "Bad request" 写到 stderr,
51
+ // 实测 execFileSync 失败时这串会泄漏到终端,污染 status 输出
52
+ const out = execFileSync('launchctl', ['print', `system/${label}`], {
53
+ encoding: 'utf8',
54
+ stdio: ['ignore', 'pipe', 'ignore'],
55
+ })
51
56
  const state = (out.match(/^\s*state\s*=\s*(\S+)/m) || [])[1]
52
57
  const pid = Number((out.match(/^\s*pid\s*=\s*(\d+)/m) || [])[1]) || null
53
58
  return { state: state === 'running' ? 'active' : state || 'inactive', pid }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lark-relay",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Lark event relay: collect events to disk, take a batch when you need it, or dispatch work to an AI agent.",
5
5
  "keywords": [
6
6
  "lark",