Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multistage commands run each stage in a different shell #17

Closed
arctic-hen7 opened this issue Jul 9, 2021 · 3 comments
Closed

Multistage commands run each stage in a different shell #17

arctic-hen7 opened this issue Jul 9, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@arctic-hen7
Copy link
Owner

Describe the bug
Any command with multiple stages will have each of its stages executed in a different subshell.

Minimum reproducible configuration

version = "0.3.0"

[scripts]
test = [ "cd /tmp", "pwd" ]

Expected behavior
The above example should print /tmp as the current directory, assuming that the two stages run in the same shell.

Actual behavior
The above example will instead print the directory in which it was executed, as the commands run in different shells.

Runtime information
Ubuntu 20.10, but this affects all systems.

@arctic-hen7 arctic-hen7 added bug Something isn't working triage This issue needs to be examined by a maintainer and removed triage This issue needs to be examined by a maintainer labels Jul 9, 2021
@arctic-hen7 arctic-hen7 self-assigned this Jul 9, 2021
@arctic-hen7
Copy link
Owner Author

This is fine from the final schema's perspective, but Bones still uses an older variant of the schema with each stage being a different BonesCore. Fixing this would require a change to that logic, but that'd be beneficial anyway. Then it'll be a matter of figuring out how to run multiple commands in the same shell.

I'll start work on this.

@arctic-hen7 arctic-hen7 changed the title Multistage commands run each stage ina different shell Multistage commands run each stage in a different shell Jul 9, 2021
@arctic-hen7
Copy link
Owner Author

Okay, this will result in a syntax change. Users must now specify delimiters to use for multistage commands. The defaults will be && for all shells except PowerShell, which will use ;. This also allows the customization of the behavior of multistage commands (e.g. you could use || instead in BASH to execute only if the previous command failed).

@arctic-hen7
Copy link
Owner Author

If that syntax is made optional though, with the reasonable default delimiter && (which works everywhere except Windows PowerShell I think), this can be a non-breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant