@@ -283,17 +283,25 @@ class Ship:
283283 # -- processes
284284
285285 def processes(self):
286− """(king pid, serf pid) of the urbit running this pier, or None."""
286+ """(king pid, serf pid) of the urbit running this pier, or None.
287+
288+ Only urbit binaries count: other commands whose arguments name
289+ the pier, such as tools/ship --pier /abs/pier itself, click or
290+ tail, are not the ship.
291+ """
287292 king = serf = None
288293 for pid in os.listdir('/proc'):
289294 if not pid.isdigit():
290295 continue
291296 try:
297+ exe = os.path.basename(os.readlink('/proc/%s/exe' % pid))
292298 with open('/proc/%s/cmdline' % pid, 'rb') as f:
293299 args = [a.decode('utf-8', 'replace')
294300 for a in f.read().split(b'\0') if a]
295301 except OSError:
296302 continue
303+ if not (exe == '.run' or exe.startswith('urbit')):
304+ continue
297305 if len(args) < 2 or self.pier not in [
298306 os.path.realpath(a) if a.startswith('/') else a
299307 for a in args[1:]]:
@@ -668,8 +676,9 @@ MERGE = r"""
668676# how many files the desk has; for each file sent with its content,
669677# whether the desk's mark, converting that content from %mime, gives
670678# the stored value; and for the files @@FROM@@ to @@FROM@@ + @@COUNT@@,
671−# the path with [%cord hash] for a cord, [%wain hash] for a %txt file's
672−# lines, each with a newline after it, or [%other 0]. A hash is the
679+# the path with [%wain hash] for a %txt file's lines, each with a
680+# newline after it (an empty file's wain is ~, an atom, so this comes
681+# first), [%cord hash] for another cord, or [%other 0]. A hash is the
673682# first 8 bytes of the sha-256. now is fixed across pages.
674683MANIFEST = r"""
675684=/ m (strand ,vase)
@@ -690,10 +699,11 @@ MANIFEST = r"""
690699 |= pax=path
691700 =/ have .^(* %cx (weld pre pax))
692701 :- pax
702+ ?: =(%txt (rear pax))
703+ :- %wain
704+ (end [3 8] (shax (rap 3 (turn ;;(wain have) |=(l=@t (cat 3 l '\0a'))))))
693705 ?@ have [%cord (end [3 8] (shax have))]
694− ?. =(%txt (rear pax)) [%other 0]
695− :- %wain
696− (end [3 8] (shax (rap 3 (turn ;;(wain have) |=(l=@t (cat 3 l '\0a'))))))
706+ [%other 0]
697707=/ jet=? =(1 (lent (to-wain:format 'a\0a')))
698708(pure:m !>([ud:.^(cass:clay %cw pre) now jet (lent all) conv page]))
699709"""