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

[CLOSED] Linux: Startup thread that launches node subprocess #170

Open
core-ai-bot opened this issue Aug 17, 2021 · 11 comments
Open

[CLOSED] Linux: Startup thread that launches node subprocess #170

core-ai-bot opened this issue Aug 17, 2021 · 11 comments

Comments

@core-ai-bot
Copy link
Member

Issue by timburgess
Monday Jul 15, 2013 at 05:11 GMT
Originally opened as adobe#278


This is some initial work in getting the node process up & running in Linux.

With this code, brackets-shell kicks off a mutexed launch thread that starts the Node executable in a subprocess.
As per the latest linux setup script, Node is launched from brackets-shell/deps/node/bin/node.

A file descriptor in the startup thread is piped to STDIN in the subprocess.
I have experimented with passing input to the node process to eval(). This works but Node appears to buffer it's output if it detects that STDIN is not a terminal. If I run node in interactive mode i.e. 'node -i' it stops buffering but produces a lot more output than I think is wanted.

I'd appreciate getting some feedback on how to run Node as then I can add code to setup a pipe from the subprocess STDOUT to a thread that reads the output.


timburgess included the following code: https://github.com/adobe/brackets-shell/pull/278/commits

@core-ai-bot
Copy link
Member Author

Comment by jasonsanjose
Monday Jul 15, 2013 at 16:44 GMT


cc @joelrbrandt to see if he has any thoughts. Assigned to @jasonsanjose.

@core-ai-bot
Copy link
Member Author

Comment by timburgess
Friday Jul 19, 2013 at 01:48 GMT


I've done more work on this and now:

  • both read & write pipes implemented to subprocess
  • node subprocess starts and runs node-core & websockets established
  • eliminates node-related startup delay of multiple seconds (yay!)
  • node debugger working
  • no more StaticServer errors in console & 'Log Node State to Console' works

node restart is yet to be implemented and there are probably more syscall checks required

@core-ai-bot
Copy link
Member Author

Comment by thefirstofthe300
Thursday Aug 08, 2013 at 21:21 GMT


I noticed a problem with the node setup script integrating with @timburgess's node setup. Tim's node setup seems to call node from the deps/node/bin directory. The grunt-mac command that linux piggy-backs calls a rename of the node binary to Brackets-node and therefore causes the entire setup to collapse unless a manual copy and rename of the Brackets-node binary to just node is done.

I think @timburgess will either want to adapt, or the grunt script needs to call a copy instead of rename.

@core-ai-bot
Copy link
Member Author

Comment by timburgess
Thursday Aug 08, 2013 at 22:36 GMT


Good point. When @jasonsanjose's grunt build PR goes into master, I will need to adjust to suit any path and or binary file name changes. At present, the code does run node from /deps/node/bin This is what the OS X build does but on OS X grunt produces a Brackets-node binary whereas the Linux script simply pulled down a binary named node. I have no issue with using the same structure as on OS X.

@core-ai-bot
Copy link
Member Author

Comment by jasonsanjose
Tuesday Aug 20, 2013 at 02:31 GMT


@timburgess the Gruntfile.js changes landed. Would you like to update this pull?

@core-ai-bot
Copy link
Member Author

Comment by timburgess
Tuesday Aug 20, 2013 at 02:33 GMT


Doing it right now :-)

@core-ai-bot
Copy link
Member Author

Comment by timburgess
Tuesday Aug 20, 2013 at 02:55 GMT


With @jasonsanjose 's Sprint 29 in master, I have rebased from master and made changes to run deps/node/bin/Brackets-node. Running this against current brackets/master, I get zero errors in the console on startup (first time I've seen that on Linux!). @DaBungalow Could you try this as well?

I have been working on an extension with node-side code so will do some more testing to confirm that it works on Linux in the same way it does on OS X.

@core-ai-bot
Copy link
Member Author

Comment by timburgess
Tuesday Aug 20, 2013 at 04:07 GMT


Tried a couple of extensions with node-side code. All works for me.

@core-ai-bot
Copy link
Member Author

Comment by jasonsanjose
Tuesday Aug 20, 2013 at 05:13 GMT


Fantastic! I'll try this first thing tomorrow.

@core-ai-bot
Copy link
Member Author

Comment by joelrbrandt
Tuesday Aug 20, 2013 at 13:22 GMT


@timburgess nice! thanks for your hard work.

@core-ai-bot
Copy link
Member Author

Comment by jasonsanjose
Tuesday Aug 20, 2013 at 19:26 GMT


Closing, see #306.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant