Comments (14)
Thanks for the issue submission! I'm just trying it on Cygwin for the first time myself.
It hung for me as well, but it didn't perform a dry-run. Are you sure you don't have CONCURRENT_DRY_RUN
already set?
As for the hanging issue - it seems to be blocking on reading from (or writing to) the named pipe. Here's the last few commands before it hung:
+ printf '%s \e[1;37m%s\e[0m' 'Creating VM' '(on digitalocean)'
+ tput rc
+ read -r __crt__status
+ echo anim:
+ code=0
+ set -o errexit
+ trap INT
+ __crt__mark_task_with_code 0 0
+ local task=0
+ local code=0
+ echo task:0:0
Pressing CTRL+C runs the top-level signal handler, but then hangs at a familar place:
++ read -r __crt__status
My gut feel is that it's a buffering issue with the named pipe.
from bash-concurrent.
Yeah I worded that weirdly, I meant that it hung even in dry run mode (I tried both).
I just looked into this a bit before going to work and I found a couple of (old) Cygwin bugs relating to named pipes, including this one. I'll try to get more information on this tonight, but seems you were right about the named pipes!
from bash-concurrent.
Ah, understood! I did some googling around last night as well, but wasn't able to find an obvious way to fix the issue. I'll likely look into this more in the coming days...unless you find something first!
from bash-concurrent.
So I've got some bad news...
I'm pretty sure I've found what the issue is. Digging around a bit, I figured out that we only got into the event loop once (the part with read -r __crt__status
).
I've reproduced the issue in this simpler use case. brokenTest.sh
will only output "foo", then get stuck there, but works as expected on Linux. workingTest.sh
works fine on both Cygwin and Linux.
Basically, it seems you can only write to a FIFO once, which is not the case on Linux. This led me to this Cygwin bug in their mailing list, which seems to explain the same issue (although using C). The bug just celebrated it's third birthday, but the developer said "so if you can hang tight for a year or three, it may well get resolved", so it might get fixed soon :P
So yeah I guess this sadly isn't going to work on Cygwin anytime soon!
from bash-concurrent.
I appreciate the research you've done into this! Seems like you are exactly correct. I wonder if there's another way to drive the event loop...
A little history: concurrent used to use wait -n
(introduced in bash 4.3) for the first background process to exit. This got a bit more complicated when I introduced animations, and impossible when I introduced status updates for tasks. At that point I switched to using a named pipe which made everything much simpler. Going back to wait -n
seems difficult.
Off the top of my head, another potential alternative is to have each writer append to a shared file, then have the event loop fed by a tail -f
on that file. This would less efficiently emulate a named pipe, but may work on Cygwin.
I will look into this option (or others if you have any ideas) when I get some time.
from bash-concurrent.
Good idea with the tail -f
, this seems to unlock the event loop properly (I can now see the animations and statuses being updated properly). Something else seems to be exploding later, I'll have a look at this too.
from bash-concurrent.
Mmm so the error I now have (still no idea what's happening, but something explodes when exiting, script exits with status 1)), but at least it also explodes on Linux! My bash-fu isn't so strong (I mainly use fish) so I probably broke something obvious. Anyway I'll look into it tomorrow/Sunday.
from bash-concurrent.
Hello! I ended up implementing the event pipe as normal file on a branch here. It works great in Linux and OS X, and theoretically should solve the problem in Cygwin (but I haven't tried it yet).
I was actually merely attempting to get nested instances of concurrent
working (thus the branch name), but it seems that these features converged.
from bash-concurrent.
Alright I'll have a look tonight, thanks!
from bash-concurrent.
Yup, that works fine, thanks!
from bash-concurrent.
That's great to hear! I still want to hammer on it a bit more, but I'll close out this issue when I merge it in. Thanks for all your help!
from bash-concurrent.
Just out of curiosity, does the display update really slowly in Cygwin for you? I'm using Babun, so maybe that's the reason.
from bash-concurrent.
Seems as fast as on a native Linux box, but I've only tried it on powerful machines so that might skew the results a bit.
from bash-concurrent.
Ah, that's good! I was running it on a pretty beefy box as well, so probably just some quirk of my configuration. :)
from bash-concurrent.
Related Issues (20)
- Unset all namespaced concurrent functions and variables in task's context.
- Disallow requirement loops.
- Add a dry run flag and/or environment variable.
- Namespace "get_tasks_not_in" function.
- Use first argument as task delimiter.
- Run shellcheck automatically on push.
- An "--and-then" flag should separate groups of concurrent tasks. HOT 2
- Display bug when number of lines exceeds lines of terminal HOT 8
- Gracefully handle running without a tty.
- add project to the bpkg [Lightweight bash package manager ]
- Immediate Failure event-pipe error HOT 2
- bash 5.x support
- Does this work with zsh? HOT 1
- Refuse to run on older than bash version 4 or on non-bash.
- Display a constantly-updating widget to inform the user that the script hasn't frozen.
- Add --require-all and --before-all flags as shortcuts.
- Don't allow a task to require itself.
- Add a "--sequential" flag.
- Namespace all functions and varables to avoid overriding things in the task's environment.
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 bash-concurrent.