Skip to content

Fix: Prevent zombie processes after git remote commands - #HSFDPMUW - #1183

Open
AhmedouNdeddou wants to merge 9 commits into
steveukx:mainfrom
AhmedouNdeddou:feature/fix-zombie-processes-1062
Open

Fix: Prevent zombie processes after git remote commands - #HSFDPMUW#1183
AhmedouNdeddou wants to merge 9 commits into
steveukx:mainfrom
AhmedouNdeddou:feature/fix-zombie-processes-1062

Conversation

@AhmedouNdeddou

Copy link
Copy Markdown

Description

This change prevents zombie processes from being left behind after Git remote commands in Docker environments.

What was done

  • Added detached: true to spawn options for remote commands
  • Called child.unref() to detach from parent process
  • Only applies to remote commands (fetch, pull, push, clone, remote)

Problem

In Docker environments (node:24-alpine), zombie processes are left behind after each Git remote command.

Solution

Child processes are made independent from the parent process, allowing them to be properly cleaned up.

Closes #1062

AhmedouNdeddou and others added 9 commits July 21, 2025 18:55
###  Inhalt
Dieser Pull Request ergänzt einen Unit-Test, der die Funktionen `.add()` und `.commit()` von `simple-git` testet.

###  Details
- Erstellt temporär ein Repository in einem neuen Ordner
- Legt eine Datei `test.txt` an
- Führt `.add()` und `.commit()` durch
- Überprüft per `.log()`, ob der Commit erfolgreich war

###  Erwartung
- Git-Log enthält mindestens einen Commit
- Letzter Commit hat die Nachricht: `Add test.txt`

###  Warum ist das wichtig?
- Testet zwei der wichtigsten Basisfunktionen von `simple-git`
- Stellt sicher, dass das `add + commit`-Verhalten korrekt funktioniert
- Erhöht die Testabdeckung und stärkt das Vertrauen in die API

###  Kontext
Dieser Beitrag erfolgt im Rahmen des Hochschulprojekts **#HSFDPMUW** – Modul: Programmiermethoden & Werkzeuge.
Test: add and commit a file using simple-git #HSFDPMUW
###  Inhalt
Dieser Pull Request enthält einen Unit-Test für die Methode `.checkoutLocalBranch()` von `simple-git`.

###  Details
- Erstellt ein temporäres Git-Repository
- Macht einen leeren Initial-Commit (`--allow-empty`)
- Erstellt und wechselt zu einem neuen Branch `feature-branch` mit `.checkoutLocalBranch()`
- Prüft, ob der aktuelle Branch korrekt gesetzt wurde

###  Erwartung
- Aktueller Branch ist `feature-branch`

###  Warum ist das nützlich?
- Testet typisches Branch-Management-Verhalten
- Verifiziert, dass `.checkoutLocalBranch()` wie dokumentiert funktioniert
- Trägt zur Testabdeckung und zur Robustheit der API bei

### Kontext
Dieser Beitrag erfolgt im Rahmen des Hochschulprojekts **#HSFDPMUW** – Modul: Programmiermethoden & Werkzeuge.
Test: checkoutLocalBranch should switch to new branch #HSFDPMUW
###  Inhalt
Dieser Pull Request fügt einen Unit-Test für die Methode `.log()` von `simple-git` hinzu.

###  Details
- Erstellt ein temporäres Git-Repository
- Fügt zwei Dateien nacheinander hinzu (`file1.txt`, `file2.txt`)
- Führt jeweils einen Commit durch
- Ruft `.log()` auf und überprüft die Historie

###  Erwartung
- Git-Log gibt zwei Commits zurück
- Beide Commit-Messages sind enthalten (`first commit`, `second commit`)

###  Warum ist das nützlich?
- Testet ein zentrales Feature: die Historie der Commits
- Verifiziert das Verhalten von `.log()` mit mehreren Einträgen
- Unterstützt die langfristige Stabilität der API

### Kontext
Dieser Beitrag erfolgt im Rahmen des Hochschulprojekts **#HSFDPMUW** – Modul: Programmiermethoden & Werkzeuge.
Test: log should return multiple commits from history #HSFDPMUW
Adds native parsing of Git trailers in commit objects:
- Adds 'trailers' property to CommitResult interface
- Adds parseTrailers function in parse-commit.ts
- Parses trailers from commit message body

This allows users to access structured trailer data like:
- Signed-off-by
- Reviewed-by
- Custom trailers

Closes steveukx#1046
Uses Node.js process.env as base for environment variables in git processes.

- Adds env option to SimpleGitOptions
- Merges process.env with custom env variables in GitExecutor
- Passes env through Git factory and Git class constructor
- Allows overriding specific environment variables

Closes steveukx#1017
Prevents zombie processes in Docker environments by:
- Using detached: true in spawn options for remote commands
- Calling child.unref() to detach from parent process
- Only affects remote commands (fetch, pull, push, clone, remote)

Closes steveukx#1062
@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 475ce8f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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

Successfully merging this pull request may close these issues.

Zombie processes left after each git command which interacts with remote repo

2 participants