laravel icon indicating copy to clipboard operation
laravel copied to clipboard

Javascript error on SIGTERM from composer native:dev

Open PeteBishwhip opened this issue 11 months ago • 3 comments

What were you trying to do?

Seems to have regressed from a version that I'm yet to identify. Last known good for me was 0.7.0 - I'll run some tests.

When hitting Command+C on the terminal after running composer native:dev, the app used to close immediately. Now, it halts until a javascript alert is acknowledged:

Uncaught Exception:
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:161:15)
at writeGeneric (node:internal/stream_base_commons:152:3)
at Socket._writeGeneric (node:net:958:11)
at Socket._write (node:net:970:8)
at writeOrBuffer (node:internal/streams/writable:572:12)
at _write (node:internal/streams/writable:501:10)
at Writable.write (node:internal/streams/writable:510:10)
at execSync (node:child_process:976:20)
at node:electron/js2c/node_init:2:16318
at getAllPids (/Users/pete/Code/NativePHP/vendor/nativephp/electron/resources/js/node_modules/kill-sync/dist/cjs/treekill.js:16:55)

It appears related to the process of killing processes when SIGTERM is received.

Note: This does not seem to affect closing the app normally (using the menubar) on Mac (Where tested)

Image

What happened?

Currently, every time you close the native:dev process via Command + C, the error provided appears.

How to reproduce the bug

  1. Run composer create-project laravel/laravel nativephp-demo-test
  2. Run cd nativephp-demo-test
  3. Prepare your laravel installation as usual via npm i
  4. Run composer require nativephp/electron (Make sure you're allowing beta versions) and assert 1.0.0-beta.1 is installed.
  5. Run php artisan native:install - Agree to build NPM deps and then to run the dev server
  6. Hit Command + C
  7. ASSERT: The app throws an error (It may not on this run)
  8. For consistency, run composer native:dev
  9. Hit Command + C
  10. ASSERT: The app does not die, an alert is displayed with a JS error about the tree_kill package.

Package Versions

{
    "installed": [
        {
            "name": "nativephp/electron",
            "direct-dependency": true,
            "homepage": "https://github.com/nativephp/electron",
            "source": "https://github.com/NativePHP/electron/tree/1.0.0-beta.1",
            "version": "1.0.0-beta.1",
            "description": "Electron wrapper for the NativePHP framework.",
            "abandoned": false
        },
        {
            "name": "nativephp/laravel",
            "direct-dependency": true,
            "homepage": "https://github.com/nativephp/laravel",
            "source": "https://github.com/NativePHP/laravel/tree/1.0.0-beta.1",
            "version": "1.0.0-beta.1",
            "description": "Laravel wrapper for the NativePHP framework.",
            "abandoned": false
        },
        {
            "name": "nativephp/php-bin",
            "direct-dependency": false,
            "homepage": "https://nativephp.com",
            "source": "https://github.com/NativePHP/php-bin/tree/0.5.6",
            "version": "0.5.6",
            "description": "PHP binaries used by the NativePHP framework",
            "abandoned": false
        }
    ]
}

PHP Version

8.3.16

Laravel Version

11.39.1

Node Version

22.11.0

Which operating systems have you seen this occur on?

macOS

OS version

MacOS Sequioa 15.2

Notes

No response

PeteBishwhip avatar Jan 23 '25 16:01 PeteBishwhip