@@ -4248,7 +4248,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4248
4248
4249
4249
(dolist (quoted (if (tramp--test-expensive-test) '(nil t ) '(nil )))
4250
4250
(let ((default-directory tramp-test-temporary-file-directory)
4251
- (tmp-name (tramp--test-make-temp-name nil quoted))
4251
+ (tmp-name1 (tramp--test-make-temp-name nil quoted))
4252
+ (tmp-name2 (tramp--test-make-temp-name 'local quoted))
4252
4253
kill-buffer-query-functions proc)
4253
4254
(with-no-warnings (should-not (make-process )))
4254
4255
@@ -4278,13 +4279,13 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4278
4279
; ; Simple process using a file.
4279
4280
(unwind-protect
4280
4281
(with-temp-buffer
4281
- (write-region " foo" nil tmp-name )
4282
- (should (file-exists-p tmp-name ))
4282
+ (write-region " foo" nil tmp-name1 )
4283
+ (should (file-exists-p tmp-name1 ))
4283
4284
(setq proc
4284
4285
(with-no-warnings
4285
4286
(make-process
4286
4287
:name " test2" :buffer (current-buffer )
4287
- :command `(" cat" ,(file-name-nondirectory tmp-name ))
4288
+ :command `(" cat" ,(file-name-nondirectory tmp-name1 ))
4288
4289
:file-handler t )))
4289
4290
(should (processp proc))
4290
4291
; ; Read output.
@@ -4296,7 +4297,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4296
4297
; ; Cleanup.
4297
4298
(ignore-errors
4298
4299
(delete-process proc)
4299
- (delete-file tmp-name )))
4300
+ (delete-file tmp-name1 )))
4300
4301
4301
4302
; ; Process filter.
4302
4303
(unwind-protect
@@ -4351,7 +4352,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4351
4352
; ; Cleanup.
4352
4353
(ignore-errors (delete-process proc)))
4353
4354
4354
- ; ; Process with stderr. tramp-adb.el doesn't support it (yet).
4355
+ ; ; Process with stderr buffer . tramp-adb.el doesn't support it (yet).
4355
4356
(unless (tramp--test-adb-p)
4356
4357
(let ((stderr (generate-new-buffer " *stderr*" )))
4357
4358
(unwind-protect
@@ -4365,16 +4366,42 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4365
4366
:file-handler t )))
4366
4367
(should (processp proc))
4367
4368
; ; Read stderr.
4369
+ (with-timeout (10 (tramp--test-timeout-handler))
4370
+ (while (accept-process-output proc 0 nil t )))
4371
+ (delete-process proc)
4368
4372
(with-current-buffer stderr
4369
- (with-timeout (10 (tramp--test-timeout-handler))
4370
- (while (= (point-min ) (point-max ))
4371
- (while (accept-process-output proc 0 nil t ))))
4372
4373
(should
4373
- (string-match " ^cat:.* Is a directory" (buffer-string )))))
4374
+ (string-match " cat:.* Is a directory" (buffer-string )))))
4375
+
4376
+ ; ; Cleanup.
4377
+ (ignore-errors (delete-process proc)))
4378
+ (ignore-errors (kill-buffer stderr))))
4379
+
4380
+ ; ; Process with stderr file. tramp-adb.el doesn't support it (yet).
4381
+ (unless (tramp--test-adb-p)
4382
+ (dolist (tmpfile `(, tmp-name1 , tmp-name2 ))
4383
+ (unwind-protect
4384
+ (with-temp-buffer
4385
+ (setq proc
4386
+ (with-no-warnings
4387
+ (make-process
4388
+ :name " test6" :buffer (current-buffer )
4389
+ :command '(" cat" " /" )
4390
+ :stderr tmpfile
4391
+ :file-handler t )))
4392
+ (should (processp proc))
4393
+ ; ; Read stderr.
4394
+ (with-timeout (10 (tramp--test-timeout-handler))
4395
+ (while (accept-process-output proc nil nil t )))
4396
+ (delete-process proc)
4397
+ (with-temp-buffer
4398
+ (insert-file-contents tmpfile)
4399
+ (should
4400
+ (string-match " cat:.* Is a directory" (buffer-string )))))
4374
4401
4375
4402
; ; Cleanup.
4376
4403
(ignore-errors (delete-process proc))
4377
- (ignore-errors (kill-buffer stderr ))))))))
4404
+ (ignore-errors (delete-file tmpfile ))))))))
4378
4405
4379
4406
(ert-deftest tramp-test31-interrupt-process ()
4380
4407
" Check `interrupt-process' ."
@@ -4460,12 +4487,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4460
4487
(let ((stderr (generate-new-buffer " *stderr*" )))
4461
4488
(unwind-protect
4462
4489
(with-temp-buffer
4463
- (shell-command " error " (current-buffer ) stderr)
4490
+ (shell-command " cat / " (current-buffer ) stderr)
4464
4491
(should (= (point-min ) (point-max )))
4465
- (should
4466
- (string-match
4467
- " error:.+not found"
4468
- (with-current-buffer stderr (buffer-string )))))
4492
+ (with-current-buffer stderr
4493
+ (should
4494
+ (string-match " cat:.* Is a directory" (buffer-string )))))
4469
4495
4470
4496
; ; Cleanup.
4471
4497
(ignore-errors (kill-buffer stderr))))
@@ -4495,6 +4521,26 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4495
4521
; ; Cleanup.
4496
4522
(ignore-errors (delete-file tmp-name)))
4497
4523
4524
+ ; ; Test `async-shell-command' with error buffer. tramp-adb.el
4525
+ ; ; doesn't support it (yet).
4526
+ (unless (tramp--test-adb-p)
4527
+ (let ((stderr (generate-new-buffer " *stderr*" )) proc)
4528
+ (unwind-protect
4529
+ (with-temp-buffer
4530
+ (async-shell-command " cat /; sleep 1" (current-buffer ) stderr)
4531
+ (setq proc (get-buffer-process (current-buffer )))
4532
+ ; ; Read stderr.
4533
+ (when (processp proc)
4534
+ (with-timeout (10 (tramp--test-timeout-handler))
4535
+ (while (accept-process-output proc nil nil t )))
4536
+ (delete-process proc))
4537
+ (with-current-buffer stderr
4538
+ (should
4539
+ (string-match " cat:.* Is a directory" (buffer-string )))))
4540
+
4541
+ ; ; Cleanup.
4542
+ (ignore-errors (kill-buffer stderr)))))
4543
+
4498
4544
; ; Test sending string to `async-shell-command' .
4499
4545
(unwind-protect
4500
4546
(with-temp-buffer
@@ -4513,11 +4559,15 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
4513
4559
(while
4514
4560
(re-search-forward tramp-display-escape-sequence-regexp nil t )
4515
4561
(replace-match " " nil nil ))
4516
- ; ; We cannot use `string-equal' , because tramp-adb.el
4517
- ; ; echoes also the sent string.
4518
4562
(should
4519
- (string-match
4520
- (format " \\ `%s " (regexp-quote (file-name-nondirectory tmp-name)))
4563
+ (string-equal
4564
+ ; ; tramp-adb.el echoes, so we must add the string.
4565
+ (if (tramp--test-adb-p)
4566
+ (format
4567
+ " %s\n %s\n "
4568
+ (file-name-nondirectory tmp-name)
4569
+ (file-name-nondirectory tmp-name))
4570
+ (format " %s \n " (file-name-nondirectory tmp-name)))
4521
4571
(buffer-string ))))
4522
4572
4523
4573
; ; Cleanup.
@@ -6193,6 +6243,8 @@ If INTERACTIVE is non-nil, the tests are run interactively."
6193
6243
; ; do not work properly for `nextcloud' .
6194
6244
; ; * Fix `tramp-test29-start-file-process' and
6195
6245
; ; `tramp-test30-make-process' on MS Windows (`process-send-eof' ?).
6246
+ ; ; * Implement stderr for `adb' in `tramp-test30-make-process' and
6247
+ ; ; `tramp-test32-shell-command' .
6196
6248
; ; * Implement `tramp-test31-interrupt-process' for `adb' .
6197
6249
; ; * Fix Bug#16928 in `tramp-test43-asynchronous-requests' . A remote
6198
6250
; ; file name operation cannot run in the timer. Remove `:unstable' tag?
0 commit comments