mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
Fixes found while verifying Ruby debugging. An entry point with no arguments reached Ruby's single-string exec in rdbg, so spaces and shell syntax were interpreted; it now goes through ruby -S -- and stays literal. rdbg sends no DAP output or process events, so its output streams are forwarded and drained at shutdown, and the launched process group is terminated on Stop or a failed start; attach leaves the process alone. Bundler lookup respects BUNDLE_GEMFILE and gems.rb, gem discovery uses the configuration's environment, and the missing debug gem message is translated. Refs #2170 Co-authored-by: krmbzds <1383035+krmbzds@users.noreply.github.com>
22 lines
992 B
TypeScript
22 lines
992 B
TypeScript
/**
|
|
* Why a debug session didn't start, as the user reads it. An adapter that listens for
|
|
* the debuggee (php-debug waiting for Xdebug) fails with Node's
|
|
* `listen EADDRINUSE: address already in use :::9003` when another IDE holds the port.
|
|
*/
|
|
import { tx } from "@/platform/i18n";
|
|
|
|
const PORT_IN_USE = /\bEADDRINUSE\b.*:(\d+)\s*$/;
|
|
const RUBY_DEBUG_MISSING =
|
|
/^the bundle of (.+) has no `debug` gem\. Add `gem "debug"` to the Gemfile and run `bundle install`$/;
|
|
|
|
export function startFailureMessage(e: unknown): string {
|
|
const message = e instanceof Error ? e.message : String(e);
|
|
const gemfile = RUBY_DEBUG_MISSING.exec(message)?.[1];
|
|
if (gemfile)
|
|
return tx`the bundle of ${gemfile} has no \`debug\` gem. Add \`gem "debug"\` to the Gemfile and run \`bundle install\``;
|
|
const port = PORT_IN_USE.exec(message)?.[1];
|
|
return port
|
|
? tx`Port ${port} is already in use: another IDE or debug session may be listening on it. Stop it or choose another port.`
|
|
: message;
|
|
}
|