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

Closes webpack dev server and exits process on "end" stdin #7203

Merged
merged 4 commits into from Feb 19, 2020

Conversation

kelseyleftwich
Copy link
Contributor

This is the same functionality as PR #3430 originally submitted by @jakehasler

The original PR broke the CI. It went unaddressed, went stale, and was automatically closed.

Like Jake, my team is integrating CRA with an elixir-phoenix app and the CRA isn't getting closed when the main process is killed.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@iansu iansu closed this Jun 19, 2019
@iansu iansu reopened this Jun 19, 2019
@bugzpodder bugzpodder added this to the 3.0.2 milestone Jun 19, 2019
@iansu iansu closed this Aug 8, 2019
@iansu iansu reopened this Aug 8, 2019
@iansu iansu closed this Aug 9, 2019
@iansu iansu reopened this Aug 9, 2019
@iansu
Copy link
Contributor

iansu commented Aug 9, 2019

I've rerun the tests a couple of times and they keep failing on the Kitchensink and KitchensinkEject test suites. We will need to get those fixed before we can merge this.

@iansu iansu modified the milestones: 3.1, 3.2 Aug 9, 2019
@iansu iansu added this to In progress in v3.3 via automation Aug 9, 2019
@aj-foster
Copy link

My team is interested in seeing these changes merged as well. Does anyone have advice concerning how we might contribute to getting the tests to pass? According to the CI logs it looks like no tests are failing, but rather something is stalling during the runs.

@iansu iansu closed this Oct 11, 2019
v3.3 automation moved this from In progress to Done Oct 11, 2019
@iansu iansu reopened this Oct 11, 2019
v3.3 automation moved this from Done to In progress Oct 11, 2019
@ianschmitz ianschmitz closed this Oct 15, 2019
v3.3 automation moved this from In progress to Done Oct 15, 2019
@ianschmitz ianschmitz reopened this Oct 15, 2019
v3.3 automation moved this from Done to In progress Oct 15, 2019
@ianschmitz ianschmitz self-assigned this Oct 15, 2019
@ianschmitz
Copy link
Contributor

@kelseyleftwich, @aj-foster - I've fixed CI but i want to confirm that the change doesn't break it for your use case. Can you test it for me with the updated logic? See e44d202.

@aj-foster
Copy link

Unfortunately, I haven't been able to make it work as a Phoenix development watcher. In that context, isInteractive is undefined (It is true in the normal way of running things). This isn't too surprising, as although stdout makes its way to the terminal along with the API's output, there is not an opportunity for someone to interact with the process.

Wish I could come here with a solution rather than just bad news, but what's happening in CI doesn't make sense to me.

@rschef
Copy link

rschef commented Nov 7, 2019

I have the same use case as @aj-foster, so I would like to propose a solution:

const exitOnStdinEnd = process.env.EXIT_ON_STDIN_END === 'true';

if (isInteractive || exitOnStdinEnd) {
  // Gracefully exit when stdin ends
  process.stdin.on('end', function() {
  devServer.close();
    process.exit();
  });
  process.stdin.resume();
}

I know it's not ideal, but it would work for us.

@ianschmitz What do you think?

@ianschmitz
Copy link
Contributor

Hmm not super pumped on adding another env variable. I'm sure there's another way to accomplish this?

@ianschmitz ianschmitz modified the milestones: 3.3, 3.4 Dec 5, 2019
@rschef
Copy link

rschef commented Dec 29, 2019

@ianschmitz What if we use the CI env variable instead of isInteractive?

if (process.env.CI !== 'true') {
  // Gracefully exit when stdin ends
  process.stdin.on('end', function() {
    devServer.close();
    process.exit();
  });
  process.stdin.resume();
}

@pedro-lb
Copy link

@ianschmitz What if we use the CI env variable instead of isInteractive?

if (process.env.CI !== 'true') {
  // Gracefully exit when stdin ends
  process.stdin.on('end', function() {
    devServer.close();
    process.exit();
  });
  process.stdin.resume();
}

Looks like a good solution to me! Since this doesn't add more env variables.

@ianschmitz
Copy link
Contributor

How about (isInteractive || process.env.CI !== 'true')? Would that solve everyone's use case?

@rschef
Copy link

rschef commented Jan 31, 2020

@ianschmitz yes, that would work for us!

@iansu iansu modified the milestones: 3.4, 3.5 Feb 14, 2020
@ianschmitz ianschmitz modified the milestones: 3.5, 3.4.1 Feb 19, 2020
@ianschmitz ianschmitz merged commit 7e6d6cd into facebook:master Feb 19, 2020
@lock lock bot locked and limited conversation to collaborators Feb 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
v3.3
  
In progress
Development

Successfully merging this pull request may close these issues.

None yet

9 participants