raco: fix command name selection by prefix

Repairs a problem with 409321c03b.

Merge to v6.9
This commit is contained in:
Matthew Flatt 2017-04-10 08:13:35 -06:00
parent 016b8009c5
commit 662fd84eda
2 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,15 @@
#lang racket/base
(require compiler/find-exe
racket/system)
;; Make sure that `raco` recognizes unambiguous command prefixes.
;; This test assumes that "pk" will unambiguously refer to "pkg".
(define o (open-output-bytes))
(parameterize ([current-output-port o])
(system* (find-exe)
"-N" "raco"
"-l-" "raco"
"pk"))
(unless (regexp-match? #rx"raco pkg install" (get-output-bytes o))
(error "expected output from `raco pkg`"))

View File

@ -52,7 +52,7 @@
[tool (and (pair? cmdline) [tool (and (pair? cmdline)
(or (hash-ref tools (car cmdline) #f) (or (hash-ref tools (car cmdline) #f)
(and (= (hash-count prefix-tools) 1) (and (= (hash-count prefix-tools) 1)
(hash-ref tools (car cmdline) #f))))] (car (hash-values prefix-tools)))))]
[ambiguous? (> (hash-count prefix-tools) 1)] [ambiguous? (> (hash-count prefix-tools) 1)]
[show-all? [show-all?
(cond (cond