返回 DeepSeek-Reasonix
bash_cmdline.go
根目录 / internal / tool / builtin / bash_cmdline.go
1 package builtin
2
3 import (
4 "errors"
5 "fmt"
6 )
7
8 // errCommandLineTooLong marks a launch the OS would refuse because the
9 // command line itself is over its length ceiling; nothing was started.
10 var errCommandLineTooLong = errors.New("command line too long")
11
12 // checkCommandLine refuses argv that cannot be launched on this OS, so the
13 // model learns the host limit instead of a misleading "filename or extension
14 // is too long" from process creation.
15 func checkCommandLine(argv []string) error {
16 units, limit := commandLineUnits(argv)
17 if limit == 0 || units <= limit {
18 return nil
19 }
20 return fmt.Errorf("%w: the command is %d characters and Windows accepts at most %d, so it was not run. "+
21 "Write long text with write_file or edit_file and have the command read that file, or split the work into smaller commands",
22 errCommandLineTooLong, units, limit)
23 }
24
24 lines GO