SIGN IN SIGN UP

fix(staging): Windows /dev/shm crash in image-to-image QFRAW staging

QuantFuncGenerate.generate hardcoded dir="/dev/shm" for the ref-image and
inpaint-mask QFRAW staging files. On Windows /dev/shm resolves drive-relative
to <drive>:\dev\shm (absent) -> FileNotFoundError on any i2i/edit/inpaint that
passes ref images or a mask. The output side (worker.py) already guarded this;
the input side was missed. Mirror that guard: use /dev/shm only when it exists
and is writable, else tempfile.gettempdir().

Also from multi-dimensional review:
- track the ref-blob path BEFORE the write so a mid-write failure on %TEMP%
  (real disk on Windows, unlike Linux tmpfs) is still unlinked by the finally;
  the mask path already ordered it this way.
- signal.SIGKILL is absent on Windows (AttributeError that an except OSError
  would let escape / an except Exception would silently swallow). Both os.kill
  SIGKILL sites now use getattr(signal, "SIGKILL", signal.SIGTERM); on Windows
  os.kill maps SIGTERM to TerminateProcess.

Verified on a real Windows box (Python 3.13): old code reproduces the exact
FileNotFoundError(<drive>:\dev\shm); patched guard falls back to %TEMP% and
round-trips a valid QFRAW blob byte-identically. Zero behavior change on Linux
(guard resolves to /dev/shm; SIGKILL still resolves to SIGKILL).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Y
yejianhui committed
f9ce46da245e7289a460b6ecdf7eb9ca13f6ea4a
Parent: 2cb3846