-
Notifications
You must be signed in to change notification settings - Fork 455
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
bsb -make-world -w exits early when backgrounded #2750
Comments
hmm, seems only one commit https://github.com/BuckleScript/bucklescript/commits/master/lib/bsb |
I'm on Ubuntu 16.04 Linux. I've tested with multiple terminals on bash and fish shells and the same problem occurs. It doesn't seem to occur with sh shell though |
@lpil and @bobzhang I do see multiple issues with 3.0! (/me should probably update from 1.6/7* sometime...) I tested in a variety of shells, results: Both ZSH and Bash in redhat, it looks like something is really funky with the stream handling in bsb, specifically when it is backgrounded and then anything happens over stdin then it gets suspended, like it's not buffering data (wtf?)... When stdin is resumed then it works fine. Bash in cygwin, it works fine, although it zombified when stdin closed, I now have a zombie bsb watcher running on the windows (what the heck?! BUG!!!). For comparison I just tested, 1.7 is working fine on bash in cygwin on windows, and 1.7 is working fine on both zsh and bash on redhat, all when backgrounded and all. Something got royally borked on both linux and windows (in different ways) since 1.7... (EDIT: Nope, 1.7 works fine too) |
From what I can find (https://superuser.com/a/973036 and phoenixframework/phoenix#2215 (comment)), detaching a process in background mode detaches stdin. So this would have been the behaviour for some time already. Proposal: I'll submit a PR that adds a flag/config option to listen to stdin or not, so that you have the choise to run it in background (without the flag) and also use it on windows (because there listening to stdin is not enabled at the moment) |
curious why do you need run watch mode in background? |
Just a simple unix-y way of running all the build tools without faffing with multiple terminals or writing a program that will manage multiple subprocesses. |
Because that's a lot more work than putting |
Won't it output into your console though, mixing up whatever else you are doing anyway then? |
With the exception of |
I've just tried this out myself and it's really easy to reproduce (https://nodejs.org/dist/latest-v9.x/docs/api/process.html#process_signal_events) #!/usr/bin/env node
const fs = require('fs');
process.stdin.resume();
fs.watch('to_watch', ()=> {console.log('changed')}); If you run this in background mode you get the same behaviour. Press enter and watch stops. Put it on the foreground and watch resumes. Anyone with more node knowledge who can give a hint on how this can be improved? For now I'm still on the opinion that a flag to enable this behaviour would be the best. |
Flags are good, and who knows about node, maybe newer versions are acting weird, wouldn't surprise me, should probably be an OCaml native file instead. 😄 |
@bobzhang are you ok with a flag? (This is probably a bit more work because I'll need to add the flag and documentation to other scripts as well?) |
@OvermindDL1 if you have a cross platform solution using OCaml, that would be perfect : ) I am not sure that running |
Is a flag required? This sounds like a bug to me as it is exiting when stdin is not closed. |
@lpil see my earlier comment. This looks like a bug in node (submitted it here: nodejs/node#20148) @bobzhang the flag would still allow windows people to run it, now it's hard coded to linux/mac |
I've never made a file watcher in OCaml but I think a flag override is fine personally, though I would opt to follow the unix standard by default and have the flag disable it (perhaps I was curious about simple single-file no-op with the latest bsb, I got 0.085s, not bad for node at all I do think, though even notoriously slow MakeFiles for C++ (a project that was already compiled but had a few hundred files) took less than half that time (0.041s) and the same project (it's build with cmake so different generators are easy) already built so just having ninja try to compile an already built project took 0.008s, so node is not native-fast by any stretch, but it is 'fast enough'. ^.^; |
They state:
Yeah, but that's not a close signal, so... why is the process pausing... |
hi @OvermindDL1, I meant |
There are inotify shims for Windows though that run fine when compiled via cygwin. Not sure where I bemoaned node though? I did show it was pretty blazing fast, within a magnitude of C++, which is impressive (is what I was saying, compared to, oh, java, which takes a while just to setup the VM before it runs any code). |
Maybe related: lerna/lerna#1745 I am trying to use lerna to execute multiple |
Any solutions in sight for this? I've also tried running bs in monorepo by using lerna, oao and |
My VERY DIRTY UGLY workaround is that I change lerna code on npm prepare hook... https://github.com/phenomic/phenomic/blob/5ab7337850b5359a707a69aa62acdd256c5f1831/package.json#L59-L62 We should really check if lerna can help here. Not sure who is the real culprit. |
I ran into this as well (bs-platform 7.3.2) trying to use a docker container running working
and dockerfile:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I've been running bsb like so
./node_modules/.bin/bsb -make-world -w &
.This worked with the
2.*
range, but now with the3.0.0
release bsb exits after compiling instead of watching.The text was updated successfully, but these errors were encountered: