I have this code:

(defun send-raw-key-fun (str)
  (lexical-let ((str str))
    (lambda ()
      (interactive)
      (term-send-raw-string (read-kbd-macro str)))))

 (define-key term-raw-map (kbd "C-c c") (send-raw-key-fun "C-c"))

and it doesn’t work anymore with ansi-term. I’m not able to end the process inside.

Got error:

(wrong-type-argument stringp [3])

Does anyone know what to do to make this code work again?