Skip to content

Ignore socks errors and repl #34

@GoogleIsEvil

Description

@GoogleIsEvil
  1. Is there some way to get a repl that is connected to the (attached) debug session? The debug console does not allow creating variables, functions, etc which would be helpful.

  2. I get this error a lot which interrupts my process due to how the host app responds to it.

I replaced sendFully with
-- Define a global flag (modify this name to avoid conflicts)
_TERMINATE_SCRIPT = false

local function terminate_script()
-- Set the flag and return to unwind the current function
_TERMINATE_SCRIPT = true
return
end

local function sendFully(str)
local first = 1
while first <= #str do
-- Check the termination flag at each iteration
if _TERMINATE_SCRIPT then return end

local sent = sock:send(str, first)
if sent and sent > 0 then
  first = first + sent
else
  if not ignoreSockError then
    error('sock:send() returned < 0') -- Original error behavior
  else
    terminate_script()
    return -- Exit sendFully() immediately
  end
end

end
end

along with adding ignoreSockError config.

This code was actually generated by qwen ai as it figured out how to go about doing this. I have to do it this way because I have no way to exit my script with os.exit or any other means. If error is used the host wants to make a big fuss about the script.

So any time I terminate the debugger in vscode I have to go to the host and give it a cookie to shut it up and this interrupts the flow.

Also, I'm having to use a task to launch my script using a shell command(since it is remotely launched). To make it work I have to use an arbitrary time delay as I wait for the debugger to boot up. I usually wait about 1.5seconds and it seems any lower I start to risk false starts.

Is there any way or could there be to have the task launch after the debugger goes into waiting?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions