Skip to content

Process.start of non existent command triggers a later OS SIGPIPE crash on MacOS #182436

Description

@zafnz

Steps to reproduce

Simplest case:

  1. in main() call Process.start('no-such-command')
  2. catch the exception, ignore it (or handle it or do whatever)
  3. a short while later the app will receive an OS SIGPIPE and exit with error code 141.

See attached proof of concept. You can comment out the debugPrints, they don't affect it.

Note:

  • Tested only on macOS 26.2. Don't know about other operating systems.
  • I have DISABLED app-security sandbox on macOS.
  • This does NOT happen under flutter run
  • This DOES happen with release builds
  • This DOES happen with debug builds too.
  • Tested with flutter 3.41.1
  • Tested a basic Dart script that runs Process.start() then sleeps for 30 seconds, no problem.

main.dart.txt (.txt because git doesn't like .dart)

Expected results

Starting a process that does not exist should throw a ProcessException: No such file or directory and then (assuming it is caught) the app happily continue forevermore.

Actual results

$ ./build/macos/Build/Products/Release/sigpipe_test.app/Contents/MacOS/sigpipe_test
2026-02-15 23:52:56.477 sigpipe_test[31484:76352308] Running with merged UI and platform thread. Experimental.
flutter: === About to call Process.start("no-such-command") ===
flutter: === Process.start error: ProcessException: No such file or directory
flutter:   Command: no-such-command  ===
(venv) zaf ~/sigpipe-test main $ echo $?
141
(venv) zaf ~/sigpipe-test main $

The app screen appears and then immediately closes (flashes). When run in flutter run, app runs fine.

Code sample

Code sample
import 'dart:io';
import 'package:flutter/material.dart';

void main() {
  debugPrint('=== About to call Process.start("no-such-command") ===');
  Process.start('no-such-command', []).then((process) {
    debugPrint('=== Process started (unexpected): pid=${process.pid} ===');
  }).catchError((error) {
    debugPrint('=== Process.start error: $error ===');
  });

  runApp(const SigpipeTestApp());
}

class SigpipeTestApp extends StatelessWidget {
  const SigpipeTestApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'SIGPIPE Test',
      home: Scaffold(
        appBar: AppBar(title: const Text('SIGPIPE Test')),
        body: const Center(
          child: Text('App is running. If SIGPIPE hits, this will exit.'),
        ),
      ),
    );
  }
}

Screenshots or Video

N/A

Logs

Logs
$ ./build/macos/Build/Products/Release/sigpipe_test.app/Contents/MacOS/sigpipe_test
2026-02-15 23:52:56.477 sigpipe_test[31484:76352308] Running with merged UI and platform thread. Experimental.
flutter: === About to call Process.start("no-such-command") ===
flutter: === Process.start error: ProcessException: No such file or directory
flutter:   Command: no-such-command  ===
(venv) zaf ~/sigpipe-test main $ echo $?
141
(venv) zaf ~/sigpipe-test main $

Flutter Doctor output

Doctor output
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.41.1, on macOS 26.2 25C56 darwin-arm64, locale en-AU)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/to/macos-android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✓] Xcode - develop for iOS and macOS (Xcode 26.2)
[✓] Chrome - develop for the web
[✓] Connected device (3 available)
  <snip out my devices>
[✓] Network resources

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consoleengineflutter/engine related. See also e: labels.platform-macosBuilding on or for macOS specificallyteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions