iTerm2 Supply PWD to coprocess in capture output trigger How do you supply PWD to a coprocess script?

For instance, given the below trigger:


When I double click the captured output, it runs the script: ~/rerun_test.sh supplying the filename that was matched: \1.

However, the application I work with does not output the present working directory (PWD) so I need to have it available to me as a variable that I can supply somehow or the other.
For semantic history when you run a command the PWD is \5 for instance:


  Command runs when you activate Semantic History on any filename. Use \1 for filename, \2 for line number, \3 for text before click, \4 for text after click, \5 for pwd. You can also use interpolated string syntax.


Is there anything equivalent that I can resort to? Obviously in this context: ~/rerun_test.sh \1 \5 does not work.
Confirm - I guess that's a bug in iTerm2.
IMHO, the sub-shell in which your command is executed should point to the same working directory as your main shell (at that point). It doesn't, and it actually happens to be / - which is bad, and prevents your script/any editor from finding the file.
Just as a side note in case someone is using &quot;capture output&quot; in combination with clang or clang++: there is an ugly workaround... one can force the compiler to print absolute paths only, even if the inputs were given as relative paths:
`-fdiagnostics-absolute-paths`