Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !1754

Stop watch process when process.stdin ends closes #1753

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/wmonk/handle-process-stdin into master 8 years ago
  • Overview 10
  • Commits 3
  • Pipelines 0
  • Changes 2

Created by: wmonk

What has been done

  • When process.stdin fires an end event, the process exits with a 0 exit code

How has this been tested

  • Started the app normally :white_check_mark:
  • Started the app when another app was already running (chose a new port) :white_check_mark:
  • Started the app via phoenix :white_check_mark:
Checking approval status

Closed by (Jul 25, 2025 5:56am UTC)

Loading

Activity


  • Administrator
    Administrator @root · 8 years ago
    Author Contributor

    Created by: facebook-github-bot

    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 - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

    If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions.

  • Administrator
    Administrator @root · 8 years ago
    Author Contributor

    Created by: facebook-github-bot

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

  • Administrator
    Administrator @root · 8 years ago
    Author Contributor

    Created by: gaearon

    Should this also happen for build and test? Could you explain more about what resume() does?

  • Administrator
    Administrator @root · 8 years ago
    Author Contributor

    Created by: wmonk

    I don't think this needs to happen for build and test, both of those scripts will exit once they've finished processing.

    To be honest, i'm not 100% familiar with what resume(), but has been used by all other mentioned projects to enable this behaviour. From what I have read, it essentially starts reading from the stdin stream, which it doesn't do automatically unless you explicitly call process.stdin.on('data', callback). You can test it with:

    $ echo "{ foo: 'bar' }" | node -e 'process.stdin.on("data", d => console.log(d.toString()))'
    // { foo: 'bar' }
    
    $ echo "{ foo: 'bar' }" | node -e 'process.stdin.on("end", () => console.log("hello world"))'
    // 
    
    $ echo "{ foo: 'bar' }" | node -e 'process.stdin.on("end", () => console.log("hello world")); process.stdin.resume()'
    // hello world
  • Administrator
    Administrator @root · 8 years ago
    Author Contributor

    Created by: gaearon

    I don't think this needs to happen for build and test, both of those scripts will exit once they've finished processing.

    True for build, but test runs a watcher by default.

  • Administrator
    Administrator @root · 8 years ago
    Author Contributor

    Created by: wmonk

    @gaearon have just tested this, and you are right, the test process hangs around.

  • Administrator
    Administrator @root · 8 years ago
    Author Contributor

    Created by: ianmcnally

    Design/style Q: would it make sense to make a helper, since this code is duplicated across two files?

    Like:

    // in a new dev script
    
    function addExitHandlersToProcess(process) {
      process.stdin.on('end', function() {
        process.exit(0);
      });
      process.stdin.resume();
      }
    }
    

    And call it in start.js and test.js. Along with cutting down duplication, it would add some self-documentation.

  • Administrator
    Administrator @root · 8 years ago
    Author Contributor

    Created by: gaearon

    We could put it in react-dev-utils I guess, like we do with other helpers. Then this doesn't need to live in user projects after ejecting.

  • Administrator
    Administrator @root · 8 years ago
    Author Contributor

    Created by: gaearon

    For some reason this breaks the CI.

  • Administrator
    Administrator @root · 7 years ago
    Author Contributor

    Created by: gaearon

    I’m open to getting this in, but the CI needs to pass.

Please register or sign in to reply
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
1
CLA Signed
1
CLA Signed
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference: facebook/create-react-app!1754
Source branch: github/fork/wmonk/handle-process-stdin

Menu

Explore Projects Groups Snippets