Skip to content

Run: run every '+' continuation line once - #2374

Open
pulchart wants to merge 1 commit into
aros-development-team:masterfrom
pulchart:wip/jpu/run-continuation
Open

pulchart wants to merge 1 commit into
aros-development-team:masterfrom
pulchart:wip/jpu/run-continuation

Conversation

@pulchart

Copy link
Copy Markdown
Contributor

In a script, Run ran only the first line of a + continuation:

Run >NIL: C:Echo >OUT:c.txt three +
C:Echo >>OUT:d.txt four +
C:Echo >>OUT:d.txt five

OUT:d.txt was never written. The Shell joins the lines into Run's argument line and the background CLI reads them from its script input, but Run gave the started commands the same handle as Input(). RunCommand() injects each command's arguments into Input() and flushes it afterwards, which drops the lines not yet read. With continuation lines the commands now get their own NIL: input, which the CLI closes on exit like before. A single-line Run, including Run Execute script, keeps the shared handle.

The command taken from the argument line already holds the continuation lines, so Run appends its buffered input only to a single line. Otherwise the fixed CLI would run them twice.

runcommandredir gains a case with continued lines: each must run once and read NIL:. It fails on the current Run.

The Shell joins '+' continuation lines into Run's argument line, and the
background CLI reads them from its script input. Run gave the commands the
same handle as Input(). RunCommand() injects each command's arguments into
Input() and flushes it afterwards, so only the first line ran. With
continuation lines the commands now get their own NIL: input.

The command taken from the argument line already holds these lines, so the
buffered input is appended only to a single line; otherwise they would run
twice.

runcommandredir checks that every continued line runs once.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant