AdaCore / AdaCore/gnatstudio

GPS.Process on_exit callback $3 parameter is erroneous

Open
#143 2 comments 0 reactions 1 assignee View on GitHub

@AdrienBoulanger is already working on this.

Since May 19, 2023.

Dominant language
Ada
Stars
531
Forks
65
PR merge metrics
No merged PRs in 30d

Description

GPS.Process on_exit callback $3 parameter is erroneous

Environment:

Debian GNU/Linux 10 X86_64
GNAT Studio 23.0w (20220512)

Bug Description:

When using GPS.Process and its on_exit callback in GNAT Studio plugins [1];

A. When no regexp is used, and on_match is set to None [2]

The issue is that the third parameter given to the on_exit callback contains twice all the output since the process has been launched.

B. When regexp is used, and on_match is set [3]

The issue is that the third parameter given to the on_exit callback contains all the output since the process has been launched, and not only "the output of the process since the last call to on match()", as specified in the documentation.

When different regexp is used, i.e regexp='^[\x20-\x7E]', this issue can occurs randomly

[1] https://docs.adacore.com/live/wave/gps/html/gps_ug/GPS.html#gps-process
on_exit is a subprogram called when the process has exited. You can no longer send input to it at this stage. Its parameters are:

$1 = the instance of GPS.Process

$2 = the exit status

$3 = the output of the process since the last call to on_match()

[2]
proc = backend.process(command=command,regexp='',on_match=None, before_kill=on_kill, remote_server="Execution_Server", on_exit=on_exit, strip_cr=False, progress_regexp="^ *completed (\d*) out of (\d*)")

[3]
proc = GPS.Process(command=command,regexp='.+',on_match=on_match, before_kill=on_kill, remote_server="Execution_Server", on_exit=on_exit, strip_cr=False, progress_regexp="^ *completed (\d*)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.