Subject: Re: bug#41099: 28.0.50; TRAMP process-file ignores exit status of remote process

From: Philipp Stephani <[email-masked]>
Date: Tue, 5 May 2020 21:02:40 +0200

Am Di., 5. Mai 2020 um 20:50 Uhr schrieb Philipp Stephani
<[email-masked]>:
>
>
> emacs -Q -batch -eval '(let ((default-directory "/ssh:HOST:/")) (print (process-file "bash" nil nil nil "-c" "exit 42")))'
> Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none HOST’
> Tramp: Found remote shell prompt on ‘HOST’
>
> 1
>
> Note that the return value of `process-file' is 1 instead of 42.
>
> The relevant debug output is
>
> 20:46:42.302070 tramp-send-command (6) # ( cd / && bash -c exit\ 42 </dev/null; echo tramp_exit_status $? )
> 20:46:42.331851 tramp-wait-for-regexp (6) #
> tramp_exit_status 42
>
> i.e. TRAMP should have access to the correct exit status.

It looks like `tramp-send-command-and-check' should not just search
for the exit code, but also return it.