Launcher: stop when the cache or save directory cannot be created #53

Open
Yoshi-233 wants to merge 1 commit from upstream-pr/53 into main
Yoshi-233 commented 2026-11-25 07:06:26 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by Yoshi-233 on 2026-11-25T06:25:13Z.


On 90b529f, passing an existing file as -Data lets play.ps1 start the child and report success even though the requested save directory doesn't exist. The same happens with -Cache, or when a parent component is a file.

The launcher now prepares each directory with terminating error handling and checks that the literal path names a directory before starting the child. The literal check also handles paths containing brackets.

I tested the original and patched scripts with PowerShell 7.7 on Linux and a stand-in executable that records whether it was launched. Five configurations failed to provide a directory: a file at either final path, a file in either parent path, and a save directory under an unwritable parent. The original launched the child and returned 0 in all five. The patch returned 1 in all five, preserved existing files, and stopped before launching the child. Default, existing, nested and relative paths with spaces and brackets worked, as did a retry with a valid path.

This covers setup before launch. #15 handles the exit code after the child runs, and #17 handles locating the executable. Windows PowerShell 5.1 remains to be tested.

<!-- greyfinch-sync:Zettrox/ztrx:issue:6598599465 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/53). Originally posted by [Yoshi-233](https://github.com/Yoshi-233) on 2026-11-25T06:25:13Z. --- On `90b529f`, passing an existing file as `-Data` lets `play.ps1` start the child and report success even though the requested save directory doesn't exist. The same happens with `-Cache`, or when a parent component is a file. The launcher now prepares each directory with terminating error handling and checks that the literal path names a directory before starting the child. The literal check also handles paths containing brackets. I tested the original and patched scripts with PowerShell 7.7 on Linux and a stand-in executable that records whether it was launched. Five configurations failed to provide a directory: a file at either final path, a file in either parent path, and a save directory under an unwritable parent. The original launched the child and returned 0 in all five. The patch returned 1 in all five, preserved existing files, and stopped before launching the child. Default, existing, nested and relative paths with spaces and brackets worked, as did a retry with a valid path. This covers setup before launch. #15 handles the exit code after the child runs, and #17 handles locating the executable. Windows PowerShell 5.1 remains to be tested.
IIKurumiII commented 2026-11-25 09:08:58 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by IIKurumiII on 2026-11-25T09:06:50Z.


Tested 90b529f and PR commit 733efbd on Windows PowerShell 5.1.26100.9711 using a stand-in program that records each launch. I tried four cases: a file at the cache path, a file at the save path, and a file blocking a parent directory of each.

On 90b529f, all four cases launched the program and returned 0. On 733efbd, all four returned 1 without launching it, and the blocking file kept its contents. Retrying with valid cache and save paths containing spaces and brackets launched successfully and returned 0.

<!-- greyfinch-sync:Zettrox/ztrx:comment:7157892321 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/53#issuecomment-7157892321). Originally posted by [IIKurumiII](https://github.com/IIKurumiII) on 2026-11-25T09:06:50Z. --- Tested `90b529f` and PR commit `733efbd` on Windows PowerShell `5.1.26100.9711` using a stand-in program that records each launch. I tried four cases: a file at the cache path, a file at the save path, and a file blocking a parent directory of each. On `90b529f`, all four cases launched the program and returned `0`. On `733efbd`, all four returned `1` without launching it, and the blocking file kept its contents. Retrying with valid cache and save paths containing spaces and brackets launched successfully and returned `0`.
Yoshi-233 commented 2026-11-25 12:07:14 +00:00 (Migrated from github.com)
Author
First-time contributor

Imported from Zettrox/ztrx. Originally posted by Yoshi-233 on 2026-11-25T11:59:47Z.


Thanks for the Windows reproduction. I independently confirmed the four blocked cache/save path cases on Windows PowerShell 5.1.26100.9711. The additional case I checked was how this change interacts with #15.

I combined 733efbd and afe450a against 90b529f and ran the launcher twice with the same cache and save paths. With a regular file at the save path, the caller got exit code 1, the file kept its contents, and the stand-in executable never ran. After I removed the blocking file and retried, the launcher created the directory, ran the stand-in, and propagated its exit code 7.

<!-- greyfinch-sync:Zettrox/ztrx:comment:7161780015 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/53#issuecomment-7161780015). Originally posted by [Yoshi-233](https://github.com/Yoshi-233) on 2026-11-25T11:59:47Z. --- Thanks for the Windows reproduction. I independently confirmed the four blocked cache/save path cases on Windows PowerShell 5.1.26100.9711. The additional case I checked was how this change interacts with #15. I combined `733efbd` and `afe450a` against `90b529f` and ran the launcher twice with the same cache and save paths. With a regular file at the save path, the caller got exit code `1`, the file kept its contents, and the stand-in executable never ran. After I removed the blocking file and retried, the launcher created the directory, ran the stand-in, and propagated its exit code `7`.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/53:upstream-pr/53'
git switch 'upstream-pr/53'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/53'
git switch 'upstream-pr/53'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/53'
git switch 'upstream-pr/53'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/53'
git switch 'main'
git merge --squash 'upstream-pr/53'
git switch 'main'
git merge --ff-only 'upstream-pr/53'
git switch 'main'
git merge 'upstream-pr/53'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Zettrox/ztrx!53
No description provided.