fix(cli): print lldb by its path, and report a held app as held
Tried on the example with the app's sandbox, two things were wrong: - `debugger` printed `flatpak enter <id> lldb -p <pid>`, and flatpak enter runs a command without the sandbox's PATH, which /app/bin is on: "Failed to execute child process lldb". It now prints the path it found, /app/bin/lldb, which attached, listed threads and detached. - With the app held by that debugger, the handshake times out, and the client said "cannot reach basic on port ..." and exited 3, no instance, though its lock said it lived. It now says the app is alive but not answering, stopped in a debugger or hung, prints how to attach, check and end it, and exits 5. Environment::haveLldb becomes lldb, the path or empty. ShouldServeOverQuic covers the second with an instance whose lock is held and whose port is silent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2c77cdcfab
commit
5d34df7afb
5 changed files with 34 additions and 10 deletions
|
|
@ -85,7 +85,7 @@ namespace {
|
|||
environment.out = &out;
|
||||
environment.err = &err;
|
||||
environment.cwd = fs::temp_directory_path() / "crafter-debug-ShouldRunClientCommands";
|
||||
environment.haveLldb = [] { return false; };
|
||||
environment.lldb = [] { return std::string(); };
|
||||
const std::int32_t code = Cli::Run(args, environment);
|
||||
return { code, out.str(), err.str() };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@
|
|||
// connections, each get their own reply;
|
||||
// - destroying the Session answers a waiting follower and closes promptly
|
||||
// with a client still connected, and a client then finds the port dead
|
||||
// within seconds.
|
||||
// within seconds;
|
||||
// - an instance alive by its lock but silent at its port, as one a
|
||||
// debugger holds, is reported as such with how to attach, not as gone.
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
import std;
|
||||
|
|
@ -58,7 +60,7 @@ namespace {
|
|||
environment.connect = Cli::ConnectQuic;
|
||||
environment.out = &out;
|
||||
environment.err = &err;
|
||||
environment.haveLldb = [] { return false; };
|
||||
environment.lldb = [] { return std::string(); };
|
||||
const std::int32_t code = Cli::Run(args, environment);
|
||||
return { code, out.str(), err.str() };
|
||||
}
|
||||
|
|
@ -259,6 +261,15 @@ int main() {
|
|||
Check(!reply && reply.error().kind == Cli::CallError::Kind::Unreachable && deadTook < 5s,
|
||||
std::format("a client finds the port dead in {} ms", std::chrono::duration_cast<std::chrono::milliseconds>(deadTook).count()));
|
||||
|
||||
// Alive by its lock, with nothing answering at its port: what a client
|
||||
// sees of an app a debugger holds.
|
||||
{
|
||||
const Registration stopped(InstanceRecord{ .name = "held", .port = record.port, .token = "t", .protocol = protocolVersion, .sourceId = std::string(Detail::SourceId()) });
|
||||
const Ran held = Run({ "status" });
|
||||
Check(held.code == 5 && Has(held.err, "alive but not answering") && Has(held.err, "attach"),
|
||||
std::format("an app alive but silent is reported as held, with how to attach (exit {}: {})", held.code, held.err));
|
||||
}
|
||||
|
||||
std::fflush(stdout);
|
||||
std::_Exit(failures == 0 ? 0 : 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue