help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Program working with shell-command but not call-process


From: Joost Kremers
Subject: Re: Program working with shell-command but not call-process
Date: 4 Jul 2014 10:16:42 GMT
User-agent: slrn/pre1.0.0-18 (Linux)

John Mastro wrote:
> Does anyone know what situation would result in this working:
>
>     (shell-command-to-string "git --version")
>     ;=> it returns "git version 2.0.1"
>
> But not this:
>
>     (with-output-to-string
>       (call-process "git" nil standard-output nil "--version"))
>       ;=> it returns ""
>       ;=> `call-process' alone returns 53

`with-output-to-string' takes whatever is sent to `standard-output',
converts it to a string and returns it. `call-process' sends its output
to a buffer, or optionally to a file, but not to stdout. So you won't
get any output from this construct unless `standard-output' is set to a
buffer.

However, that is probably not the source of the problem you hint at (the
fact that magit doesn't work). That is most likely due to the fact that
`call-process' alone returns 53. If git were successful, it should
return 0.


-- 
Joost Kremers                                   address@hidden
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]