claude-remote 0.4.6 → 0.4.7

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/package.json +1 -1
  2. package/server.js +14 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-remote",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "Remote control bridge for Claude Code REPL - drive from phone/WebUI",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -735,7 +735,7 @@ function assertLinuxClipboardAvailable() {
735
735
  function spawnLinuxClipboardTool(tool, imageBuffer, type) {
736
736
  return new Promise((resolve, reject) => {
737
737
  const args = tool === 'xclip'
738
- ? ['-selection', 'clipboard', '-t', type, '-i']
738
+ ? ['-quiet', '-selection', 'clipboard', '-t', type, '-i']
739
739
  : ['--type', type];
740
740
  const child = spawn(tool, args, {
741
741
  detached: true,
@@ -749,16 +749,20 @@ function spawnLinuxClipboardTool(tool, imageBuffer, type) {
749
749
  if (settled) return;
750
750
  settled = true;
751
751
  if (readyTimer) clearTimeout(readyTimer);
752
- try { child.kill('SIGTERM'); } catch {}
752
+ if (child.exitCode == null && child.signalCode == null) {
753
+ try { child.kill('SIGTERM'); } catch {}
754
+ }
753
755
  reject(new Error(message));
754
756
  };
755
757
 
756
- const settleSuccess = () => {
758
+ const settleSuccess = (trackProcess = true) => {
757
759
  if (settled) return;
758
760
  settled = true;
759
761
  if (readyTimer) clearTimeout(readyTimer);
760
- activeLinuxClipboardProc = { child, tool };
761
- child.unref();
762
+ if (trackProcess && child.exitCode == null && child.signalCode == null) {
763
+ activeLinuxClipboardProc = { child, tool };
764
+ child.unref();
765
+ }
762
766
  resolve(tool);
763
767
  };
764
768
 
@@ -775,6 +779,11 @@ function spawnLinuxClipboardTool(tool, imageBuffer, type) {
775
779
  const extra = stderr.trim() ? ` stderr=${JSON.stringify(stderr.trim())}` : '';
776
780
  log(`Linux clipboard process exited (${tool}) code=${code ?? 'null'} signal=${signal ?? 'null'}${extra}`);
777
781
  if (!settled) {
782
+ if (tool === 'xclip' && code === 0 && !signal && !stderr.trim()) {
783
+ log('Linux clipboard xclip exited cleanly without stderr; treating clipboard arm as successful');
784
+ settleSuccess(false);
785
+ return;
786
+ }
778
787
  const detail = stderr.trim() || `exit code ${code ?? 'null'} signal ${signal ?? 'null'}`;
779
788
  settleFailure(`Linux clipboard tool ${tool} exited before paste: ${detail}`);
780
789
  }