public override async void Launch(Response response, dynamic arguments) { _attachMode = false; //SetExceptionBreakpoints(args.__exceptionOptions); // validate argument 'program' string programPath = DynamicHelper.GetString(arguments, "program"); if (programPath == null) { SendErrorResponse(response, 3001, "Property 'program' is missing or empty.", null); return; } //Program.Log("Program path: {0}\r\n", programPath); programPath = ConvertClientPathToDebugger(programPath); if (!File.Exists(programPath) && !Directory.Exists(programPath)) { SendErrorResponse(response, 3002, "Program '{path}' does not exist.", new { path = programPath }); return; } // validate argument 'cwd' var workingDirectory = (string)arguments.cwd; if (workingDirectory != null) { workingDirectory = workingDirectory.Trim(); if (workingDirectory.Length == 0) { SendErrorResponse(response, 3003, "Property 'cwd' is empty."); return; } workingDirectory = ConvertClientPathToDebugger(workingDirectory); if (!Directory.Exists(workingDirectory)) { SendErrorResponse(response, 3004, "Working directory '{path}' does not exist.", new { path = workingDirectory }); return; } } // Todo: handle case insensitive file systems and forward slashes _script = Path.GetFullPath(programPath).Replace('/', '\\'); _code = File.ReadAllText(programPath); if ((_ast = Parse(response, _script)) == null) { return; } const string host = "127.0.0.1"; var port = Utilities.FindFreePort(55555); bool debug = !DynamicHelper.GetBool(arguments, "noDebug", false); if (debug) { Connect(IPAddress.Parse(host), port); } var termArgs = new { kind = "external", title = "Aphid Debug Console", cwd = workingDirectory, args = programPath, //env = environmentVariables }; var resp = await SendRequest("runInTerminal", termArgs); SendResponse(response); }