Settle process-signal races across the services layer
A Process's exited and streamFinished signals aren't guaranteed to fire in order, and several services decided an outcome on whichever fired first: KdeConnect could report a successful file transfer as failed if exited landed before the real stdout payload; Clipboard could present a failed history query as an empty-but-healthy one; Brightness could strand the last queued write of a drag; SoundFeedback and SystemLocale could drop or misapply a rapid second toggle/click because re-arming an already-running Process is a no-op. All five now wait for both signals and let the authoritative one decide, matching the pattern HomeAssistantConfig.qml already used correctly. Health's "copy report" never enabled stdin, so it copied nothing while claiming success. Capture announced every recording as saved regardless of the recorder's actual exit code. Connectivity never restarted Bluetooth discovery when the adapter was enabled from an already-open page. CalendarAgenda left the UI in "loading" forever if its helper died at startup, and the helper itself could crash unguarded instead of reporting unavailable. Geocoding silently dropped a query typed while the previous one was still in flight. Notifs leaked tracked-but-undisplayed notifications under Do Not Disturb, and dismissAll() skipped them. Claude-Session: https://claude.ai/code/session_01E6TJUAh41HaP25MVHWkhRZ
This commit is contained in:
@@ -95,7 +95,16 @@ Singleton {
|
||||
|
||||
property string payload: ""
|
||||
|
||||
onStarted: copyProcess.write(copyProcess.payload)
|
||||
stdinEnabled: true
|
||||
onStarted: {
|
||||
copyProcess.write(copyProcess.payload);
|
||||
// wl-copy reads stdin until EOF before it exits; leaving the
|
||||
// channel open (Process.write alone never closes it) would hang
|
||||
// it forever waiting for more input. Disabling stdin closes the
|
||||
// write side -- see HomeAssistantConfig.qml's writeProc for the
|
||||
// same stdinEnabled pattern.
|
||||
copyProcess.stdinEnabled = false;
|
||||
}
|
||||
onExited: (exitCode, exitStatus) => {
|
||||
root.lastCopyResult = exitCode === 0
|
||||
? "Report copied."
|
||||
@@ -339,6 +348,10 @@ Singleton {
|
||||
return false;
|
||||
copyProcess.payload = JSON.stringify(root.snapshot, null, 2);
|
||||
root.lastCopyResult = "";
|
||||
// Re-arm stdin: the previous run closed it (see copyProcess.onStarted)
|
||||
// and a disabled channel stays closed even after being set back to
|
||||
// true mid-run, so each new run needs it explicitly re-enabled.
|
||||
copyProcess.stdinEnabled = true;
|
||||
copyProcess.exec(["wl-copy"]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user