Why does :command argument of make-process not work when string passed as a variable?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












This works fine:




(make-process :name "my-proc2"
:buffer " *my-proc2*"
:command '("sh" "-c" "echo "hi"nsleep 10necho "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 10necho "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.










share|improve this question

























    up vote
    1
    down vote

    favorite












    This works fine:




    (make-process :name "my-proc2"
    :buffer " *my-proc2*"
    :command '("sh" "-c" "echo "hi"nsleep 10necho "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 10necho "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.










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      This works fine:




      (make-process :name "my-proc2"
      :buffer " *my-proc2*"
      :command '("sh" "-c" "echo "hi"nsleep 10necho "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 10necho "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.










      share|improve this question













      This works fine:




      (make-process :name "my-proc2"
      :buffer " *my-proc2*"
      :command '("sh" "-c" "echo "hi"nsleep 10necho "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 10necho "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.







      variables process call-process






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      Codygman

      1236




      1236




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          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.






          share|improve this answer






















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "583"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f45256%2fwhy-does-command-argument-of-make-process-not-work-when-string-passed-as-a-vari%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote













            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.






            share|improve this answer


























              up vote
              2
              down vote













              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.






              share|improve this answer
























                up vote
                2
                down vote










                up vote
                2
                down vote









                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.






                share|improve this answer














                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.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 2 hours ago

























                answered 2 hours ago









                phils

                24.5k23362




                24.5k23362



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f45256%2fwhy-does-command-argument-of-make-process-not-work-when-string-passed-as-a-vari%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?