1

This question already has an answer here:

This works fine:

(make-process :name "my-proc2" :buffer " *my-proc2*" :command '("sh" "-c" "echo \"hi\"\nsleep 10\necho \"there\"") :connection-type 'pipe :filter (apply-partially 'my-pass-it-on-filter "/tmp/mytmprealtest"))

But if I use a variable like the code below I get Debugger entered--Lisp error: (wrong-type-argument stringp body):

(let ((body "echo \"hi\"\nsleep 10\necho \"there from var\""))
  (make-process :name "my-proc2"
        :buffer " *my-proc2*"
        :command '("sh" "-c" body)
        :connection-type 'pipe
        :filter (apply-partially 'my-pass-it-on-filter "/tmp/mytmprealtest")))

The variable should be a string as well, so why doesn't it work?

The documentation for make-process says:

...
:command COMMAND -- COMMAND is a list starting with the program file
name, followed by strings to give to the program as arguments.
...

The variable was a string as were all other arguments, so I'm not sure what is wrong.

marked as duplicate by npostavs, Stefan, Drew, phils, zck Oct 11 '18 at 16:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

You've quoted the list:

    :command '("sh" "-c" body)

So you have passed it a symbol body not the string value of the variable.

Try:

    :command (list "sh" "-c" body)

or:

    :command `("sh" "-c" ,body)

Either of which cause body to be evaluated to its string value.

Not the answer you're looking for? Browse other questions tagged or ask your own question.