Comments (10)
Hmmm. To be honest I never really wanted the commands to execute within the context of the parent shell as running in a subshell would enable you to continue working as you were within the parent shell. I do however see how this behaviour could be beneficial though. Any ideas on how this could be done? I'll have a dig around and see. Thanks for reporting!
from project.
It would also be really useful to see shell state to be preserved between workflow items too, but stringing them all into one long command isn't the solution.
from project.
There's another issue, too, in that each use of %x[ ] will create it's own subshell.
e.g.:
%x[ cd %path ]
%x[ pwd ]
should demonstrate that any sequence of commands that affect shell variables (like the current working directory) won't have any effect on commands later on down the workflow. So workflows like
:default:
- cd %path
- rake
would also be rendered useless.
The latter could possibly be solved by taking the commands and executing them altogether, rather than individually (e.g. %x[ cd %path; rake ]
). Still not sure how to solve the issue where somebody simply wants to 'jump' to the project directory, though.
from project.
Another possible option: create a shell script in a temporary directory containing all the commands that you then execute and delete.
from project.
Almost beat me to it ;) just on my phone at the moment but will definitely take a look at this when I get back, it's quite a big blocker for creating better workflows.
from project.
After looking around it seems that no matter how the problem is approached in Ruby, the effect might still be the same. Child processes cannot alter the parent processes state. One option would be to wrap the gem within a bash script so we have more control over the running process. Or maybe going against what I said above I could look for common commands (such as cd) and use the Ruby libraries to perform them instead of shelling out.
Any ideas?
from project.
If you don't want it to affect the parent shell, then the best thing to do (I think) is still to dump the commands out to a temporary shell script that gets executed.
If you want it to be able to affect the parent shell, that would have to involve creating a shell function.
from project.
In what cases would creating a temp script be more beneficial over just chaining the commands? I might opt to not affect the parent shell for now but will look into it in the future.
from project.
Well, if memory serves, most shells have some sort of a command line length limit. So any sufficiently advanced workflow wouldn't work if you tried to chain it together. I'd have to do a bit of research to determine what constitutes 'sufficiently advanced,' though. It could be that it's large enough to be of no concern.
from project.
Sure, let me know if you find anything, otherwise I'll probably go down that route now whilst looking for a more elegant fix.
from project.
Related Issues (10)
- Add in options parser HOT 7
- Commands are completely isolated from each other HOT 2
- Workflows cannot alter the state of the parent shell
- Runner could do with more testing HOT 1
- Allow commands to be daemonised
- Add project subcommands HOT 2
- Workflow steps are not independent. HOT 2
- workflow with multiple paths doesn't load HOT 4
- Add support for creating new terminal tabs and executing commands on them HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from project.