New:Socket for Asana Is Now Available.Learn more
Sign In

moshcode

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moshcode - npm Package Compare versions

Comparing version
0.62.0
to
0.63.0
+1
-1
package.json
{
"name": "moshcode",
"version": "0.62.0",
"version": "0.63.0",
"type": "module",

@@ -5,0 +5,0 @@ "description": "moshcode — a metal wrapper for coding engines and native UGig/CoinPay workflow CLIs, with OpenPRD and moshscript",

@@ -335,4 +335,20 @@ // Routing Moshpit TLDs to the local bridge, on whatever OS this is.

*/
export function pidfilePath() {
const base = process.env.XDG_RUNTIME_DIR || join(homedir(), ".moshcode") || tmpdir();
export function pidfilePath(env = process.env, exists = existsSync) {
// `dns enable` escalates, so the run that *starts* the bridge is root and the
// runs that later ask about it are not. Under sudo both XDG_RUNTIME_DIR and
// HOME belong to root, so the pidfile went to /root/.moshcode — a path the
// unprivileged `dns status` and `dns disable` never look at and could not
// read if they did. The bridge was reported "not running" for the rest of its
// life, and the fix status advised started a second one on top of it.
//
// So an escalated run records against the invoking user's runtime dir, and
// only when that directory is really there: deriving /run/user/<uid> on a
// machine without one trades an unreadable path for a nonexistent one. macOS
// has no /run/user and falls through unchanged — the escalated paths this
// matters for are the systemd-resolved ones.
const invoker = env.SUDO_UID ? `/run/user/${env.SUDO_UID}` : null;
const base = (invoker && exists(invoker) ? invoker : null)
|| env.XDG_RUNTIME_DIR
|| join(homedir(), ".moshcode")
|| tmpdir();
return join(base, "moshpit-dns.pid");

@@ -339,0 +355,0 @@ }

Sorry, the diff of this file is too big to display