Skip to content

Conversation

kittaakos
Copy link
Contributor

Motivation

Execute the Arduino CLI process without a shell.

  • security reasons,
  • some users might not have the %ComSpec% set on Windows, and CMD.exe is not on the $PATH

Remove the obsolete CLI daemon watcher process. Before arduino/arduino-cli#488, IDE2 required a way to stop the daemon process if the parent (backend) process crashed. However, this mechanism
is no longer necessary, as the CLI daemon process is not actually a true daemon process.

Change description

Other information

To verify:

  • Arduino IDE starts, and the CLI is fully functional when there is a whitespace in the path to your IDE2 installation.
  • Start IDE2. Open the task manager/activity monitor on your system. See that arduino-cli process is running. Kill the IDE2 process. See that the arduino-cli process is not running.

Closes #2112
Ref: #2067

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

Akos Kitta added 2 commits August 20, 2023 18:03
Before arduino/arduino-cli#488, IDE2 required a way to stop the daemon
process if the parent (backend) process crashed. However, this mechanism
is no longer necessary as the CLI daemon process is not actually a true
daemon process.

Signed-off-by: Akos Kitta <[email protected]>
@kittaakos kittaakos added type: enhancement Proposed improvement topic: code Related to content of the project itself topic: security Related to the protection of user data labels Aug 20, 2023
@kittaakos kittaakos self-assigned this Aug 20, 2023
@kittaakos kittaakos added the type: imperfection Perceived defect in any part of project label Aug 20, 2023
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified this fixes the problem with Arduino failing to start up with errors like:

daemon ERROR Error: spawn C:\WINDOWS\system32\cmd.exe ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

in cases where there is a problem with the user's ComSpec environment variable:

  • Variable is not defined (example)
  • Variable is set to an incorrect path (example)
  • cmd.exe has been removed (example)
  • Variable has been set to the path of an incompatible shell (example)

Thanks Akos!

@kittaakos kittaakos merged commit 57fa18b into main Aug 20, 2023
@kittaakos kittaakos deleted the #2112 branch August 20, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself topic: security Related to the protection of user data type: enhancement Proposed improvement type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Start the CLI daemon process without a shell
2 participants