"foo"
(funcall
this-shell-command-to-string
- (format "echo -n ${%s:?bla}" envvar))))))
+ (format "echo -n ${%s:-bla}" envvar))))))
(unwind-protect
;; Set the empty value.
"bla"
(funcall
this-shell-command-to-string
- (format "echo -n ${%s:?bla}" envvar))))
+ (format "echo -n ${%s:-bla}" envvar))))
;; Variable is set.
(should
(string-match
"foo"
(funcall
this-shell-command-to-string
- (format "echo -n ${%s:?bla}" envvar))))
+ (format "echo -n ${%s:-bla}" envvar))))
(let ((process-environment
(cons envvar process-environment)))
;; Variable is unset.
"bla"
(funcall
this-shell-command-to-string
- (format "echo -n ${%s:?bla}" envvar))))
+ (format "echo -n ${%s:-bla}" envvar))))
;; Variable is unset.
(should-not
(string-match
(regexp-quote envvar)
- (funcall this-shell-command-to-string "env")))))))))
+ ;; We must remove PS1, the output is truncated otherwise.
+ (funcall
+ this-shell-command-to-string "printenv | grep -v PS1")))))))))
;; This test is inspired by Bug#27009.
(ert-deftest tramp-test33-environment-variables-and-port-numbers ()
;; of process output. So we unset it temporarily.
(setenv "PS1")
(with-temp-buffer
- (should (zerop (process-file "env" nil t nil)))
+ (should (zerop (process-file "printenv" nil t nil)))
(goto-char (point-min))
(should
(re-search-forward