Function: tuareg--shell-command-to-string
tuareg--shell-command-to-string is a natively compiled function
defined in tuareg-opam.el.
Signature
(tuareg--shell-command-to-string COMMAND)
Documentation
Similar to shell-command-to-string, but returns nil when the
process return code is not 0 (shell-command-to-string returns the
error message as a string).
Source Code
;; Defined in /nix/store/6mbh851dhnag8f92qfrlh9ckldzwf6c6-emacs-packages-deps/share/emacs/site-lisp/elpa/tuareg-20260626.936/tuareg-opam.el
(defun tuareg--shell-command-to-string (command)
"Similar to `shell-command-to-string', but returns nil when the
process return code is not 0 (shell-command-to-string returns the
error message as a string)."
(let* ((return-value 0)
(return-string
(with-output-to-string
(with-current-buffer standard-output
(setq return-value
(process-file shell-file-name nil '(t nil)
nil shell-command-switch command))))))
(if (= return-value 0) return-string nil)))