build: attach: ensure we don't recursivelly call ourself.

This commit is contained in:
Alexandre Pujol 2025-09-06 23:45:08 +02:00
parent 5484f84764
commit 64d71ffb6e
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC

View file

@ -31,6 +31,9 @@ func init() {
func (b ReAttach) Apply(opt *Option, profile string) (string, error) {
var insert string
var origin = "profile " + opt.Name
if opt.File.HasSuffix("attached/base") {
return profile, nil // Do not re-attach twice
}
if strings.Contains(profile, "attach_disconnected") {
insert = "@{att} = /att/" + opt.Name + "/\n"
@ -42,13 +45,17 @@ func (b ReAttach) Apply(opt *Option, profile string) (string, error) {
"include <abstractions/base>",
"include <abstractions/attached/base>",
)
profile = strings.ReplaceAll(profile,
"include <abstractions/base-strict>",
"include <abstractions/attached/base>",
)
profile = strings.ReplaceAll(profile,
"include <abstractions/consoles>",
"include <abstractions/attached/consoles>",
)
} else {
insert = "@{att} = /\n"
insert = "@{att} = \"\"\n"
}