spawn/spawnAndWait fails to open socket
See original GitHub issueIssue Checklist
- I’m using the library programmatically
Library version
0.0.13
Runtime
Linux, Chrome Version 100.0.4896.127 (Official Build) (64-bit)
Device
DJI FPV goggles V2
Describe the bug
When trying to spawn a process:
const device = await AdbWebUsbBackend.requestDevice();
const streams = await device.connect();
const adb = await Adb.authenticate(streams, credentialStore, undefined);
const result = await adb.subprocess.spawnAndWait(["ls"]);
I get the following error (same thing with spawn
and spawnAndWaitLegacy
):
Error: Socket open failed
at AdbPacketDispatcher.handleClose (dispatcher.ts:129:1)
at Object.write (dispatcher.ts:67:1)
at g (webidl.ts:78:1)
at S (webidl.ts:88:1)
at Object.write (underlying-sink.ts:71:1)
at WritableStreamDefaultController.i [as _writeAlgorithm] (writable-stream.ts:1114:1)
at writable-stream.ts:544:1
at Br (writable-stream.ts:1202:1)
at writable-stream.ts:1171:1
at Cr (writable-stream.ts:917:1)
at Object._chunkSteps (pipe.ts:117:1)
at G (default-reader.ts:51:1)
at at (default-controller.ts:251:1)
at ReadableStreamDefaultController.enqueue (default-controller.ts:91:1)
at Object.pull (transform.ts:345:1)
This seems to be specific on my device, I tried with a phone and it works. Interestingly enough I can get a shell process no problem:
const device = await AdbWebUsbBackend.requestDevice();
const streams = await device.connect();
const adb = await Adb.authenticate(streams, credentialStore, undefined);
const socket = await adb.subprocess.shell();
const writer = socket.stdin.getWriter();
socket.stdout.pipeTo(new WritableStream({
write: (chunk) => {
console.log(decodeUtf8(chunk));
}
}));
I would really love to be able to spawn a process though and get output and exit codes. Let me know which information you need to further debug this
Steps to reproduce
const device = await AdbWebUsbBackend.requestDevice();
const streams = await device.connect();
const adb = await Adb.authenticate(streams, credentialStore, undefined);
const result = await adb.subprocess.spawnAndWait(["ls"]);
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
"Could not open socket" - Stack Overflow
It just means that somewhere between your server and the recaptcha server, there's a network communications problem that prevents the socket ...
Read more >SERVER PROCESS DOES NOT COMMUNICATE STATUS.
The server fails to open a socket on the localhost, which it uses to communicate status to the launching process. This problem can...
Read more >H29+ won't start with permission error to open ICMP socket
The opennms user requires permission to use a datagram socket to be able to send ICMP (ping) messages. By default, a user doesn't...
Read more >Windows Sockets Error Codes (Winsock2.h) - Win32 apps
Too many open files. Too many open sockets. Each implementation may have a maximum number of socket handles available, either globally, per ...
Read more >Error: Cannot open socket for listening, -102 - Esri Support
In ArcSDE 9.3 for SQL Server, when starting an ArcSDE service, the following error displays: "Cannot open socket for listening, -102" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Version 0.0.14 released with the fix.
Checked the source code of Android 6 and found out it doesn’t support the command format I use.
You can manually patch your
node_modules/@yume-chan/adb/esm/commands/subprocess/protocols/none.js
line 18 to give it a try.