Skip to content

Git initialization doesn't happen after creating a repo in a node.js app #2059

@abdullahceylan

Description

@abdullahceylan

Describe the bug

I'm using gh version 1.0.0 (2020-09-16) and trying to use it within a simple node.js application. If I run gh directly from the terminal by using gh repo create foo --private --confirm command, it is creating a folder after the repo creation and initializing repository in that folder.

But if I call ghcli in a node.js application, the repo creation being successful but folder creation and repository initialization doesn't happen.

Steps to reproduce the behavior

  1. Type gh repo create foo --private --confirm and run
  2. View the following output and observe the repository initialization in the folder created after the repo creation
✓ Created repository foo on GitHub
Initialized empty Git repository in /development/test/foo/.git/
✓ Initialized repository in './foo/'
  1. Now create a test-app.js file and paste the following code:
const childProcess = require('child_process');

return new Promise(async (resolve) => {
  await childProcess.exec(
    'gh repo create foo --private --confirm',
    (error, standardOutput, standardError) => {
      console.log('repo creation successful');
    },
  );
});

  1. Run node ./test-app.js
  2. Wait for the output
  3. Check if the repo creation, folder creation and repo initialization in that folder were successful

Expected vs actual behavior

Expected

A folder should be created in the current directory and repository initialization should be completed.

Actual

Repo creation is successful but no folder creation and repository initialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions