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

[Question] Process exit dont exit the terminal. #128

Open
prpanto opened this issue Mar 13, 2024 · 1 comment
Open

[Question] Process exit dont exit the terminal. #128

prpanto opened this issue Mar 13, 2024 · 1 comment

Comments

@prpanto
Copy link

prpanto commented Mar 13, 2024

OS: Windows 11 Home latest
terminal: Windows Terminal latest
citty: version latest
node: v20.11.1
electron: v28.2.6

I have an electron app and I try to use citty for some simple commands but when I run the .exe file all works perfect but on in the end the process dont exit. I ask because maybe is my fault. Add process.exit in the run (maybe unnecessary), tell me if is wrong.

Code I use:

const main = defineCommand({
  meta: {
    name: "hello",
    version: "1.0.0",
    description: "My Awesome CLI App",
  },
  args: {
    name: {
      type: "positional",
      description: "Your name",
      required: true,
    },
    friendly: {
      type: "boolean",
      description: "Use friendly greeting",
    },
  },
  run({ args }) {
    console.log(`${args.friendly ? "Hi" : "Greetings"} ${args.name}!`)
    process.exit(0)
  }
})

runMain(main)

Edit: The weird thing... check how the terminal behaves...

C:\{path_to_the_project}>YourAppName.exe hello MyName

C:\{path_to_the_project}>
Greetings MyName!
(now terminal stuck)


(I press `enter` and then normal)
C:\{path_to_the_project}>

What behavior I expect:

C:\{path_to_the_project}>YourAppName.exe hello MyName
Greetings MyName!

C:\{path_to_the_project}>    (no stuck just exit)
@peterroe
Copy link
Contributor

👀 Would you willing to provide a reproduction with https://stackblitz.com ?

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

2 participants