helloadhavan/github_issues huggingface dataset:
Repository: ollama/ollama
Pull request: fix parsing big endian gguf

most gguf files will be little endian but a big endian file should not panic

Changed files:
filename: llm/ggml.go
patch: @@ -231,8 +231,7 @@ const (
 	// Magic constant for `ggla` files (LoRA adapter).
 	FILE_MAGIC_GGLA = 0x67676C61
 	// Magic constant for `gguf` files (versioned, gguf)
-	FILE_MAGIC_GGUF_LE = 0x46554747
-	FILE_MAGIC_GGUF_BE = 0x47475546
+	FILE_MAGIC_GGUF = 0x46554747
 )
 
 var ErrUnsupportedFormat = errors.New("unsupported model format")
@@ -247,29 +246,27 @@ func DetectGGMLType(b []byte) string {
 		return "ggjt"
 	case FILE_MAGIC_GGLA:
 		return "ggla"
-	case FILE_MAGIC_GGUF_LE, FILE_MAGIC_GGUF_BE:
+	case FILE_MAGIC_GGUF:
 		return "gguf"
 	default:
 		return ""
 	}
 }
 
 func DecodeGGML(rs io.ReadSeeker) (*GGML, int64, error) {
-	var magic uint32
+	var magic [4]byte
 	if err := binary.Read(rs, binary.LittleEndian, &magic); err != nil {
 		return nil, 0, err
 	}
 
 	var c container
-	switch magic {
+	switch binary.LittleEndian.Uint32(magic[:]) {
 	case FILE_MAGIC_GGML, FILE_MAGIC_GGMF, FILE_MAGIC_GGJT:
 		return nil, 0, ErrUnsupportedFormat
 	case FILE_MAGIC_GGLA:
 		c = &containerGGLA{}
-	case FILE_MAGIC_GGUF_LE:
+	case FILE_MAGIC_GGUF:
 		c = &containerGGUF{ByteOrder: binary.LittleEndian}
-	case FILE_MAGIC_GGUF_BE:
-		c = &containerGGUF{ByteOrder: binary.BigEndian}
 	default:
 		return nil, 0, errors.New("invalid file magic")
 	}

filename: llm/gguf.go
patch: @@ -36,10 +36,23 @@ func (c *containerGGUF) Name() string {
 }
 
 func (c *containerGGUF) Decode(rs io.ReadSeeker) (model, error) {
-	if err := binary.Read(rs, c.ByteOrder, &c.Version); err != nil {
+	var version [4]byte
+	if err := binary.Read(rs, c.ByteOrder, &version); err != nil {
 		return nil, err
 	}
 
+	// if the lower 16 bits are 0, the byte order is probably wrong
+	if c.ByteOrder.Uint32(version[:])&1<<4 == 0 {
+		switch c.ByteOrder {
+		case binary.LittleEndian:
+			c.ByteOrder = binary.BigEndian
+		case binary.BigEndian:
+			c.ByteOrder = binary.LittleEndian
+		}
+	}
+
+	c.Version = c.ByteOrder.Uint32(version[:])
+
 	var err error
 	switch c.Version {
 	case 1:
Repository: electron/electron
Pull request: test: re-enable native module tests

Closes https://github.com/electron/electron/issues/46746.

Notes: none

Changed files:
filename: .github/workflows/pipeline-segment-electron-test.yml
patch: @@ -194,7 +194,6 @@ jobs:
         MOCHA_REPORTER: mocha-multi-reporters
         MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
         ELECTRON_DISABLE_SECURITY_WARNINGS: 1
-        ELECTRON_SKIP_NATIVE_MODULE_TESTS: true
         DISPLAY: ':99.0'
         NPM_CONFIG_MSVS_VERSION: '2022'
       run: |

filename: spec/api-browser-window-spec.ts
patch: @@ -1,4 +1,3 @@
-import { nativeImage } from 'electron';
 import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main';
 
 import { expect } from 'chai';
@@ -6713,52 +6712,6 @@ describe('BrowserWindow module', () => {
     });
   });
 
-  describe('offscreen rendering image', () => {
-    afterEach(closeAllWindows);
-
-    const imagePath = path.join(fixtures, 'assets', 'osr.png');
-    const targetImage = nativeImage.createFromPath(imagePath);
-    const nativeModulesEnabled = !process.env.ELECTRON_SKIP_NATIVE_MODULE_TESTS;
-    ifit(nativeModulesEnabled && ['win32'].includes(process.platform))('use shared texture, hardware acceleration enabled', (done) => {
-      const { ExtractPixels, InitializeGpu } = require('@electron-ci/osr-gpu');
-
-      try {
-        InitializeGpu();
-      } catch (e) {
-        console.log('Failed to initialize GPU, this spec needs a valid GPU device. Skipping...');
-        console.error(e);
-        done();
-        return;
-      }
-
-      const w = new BrowserWindow({
-        show: false,
-        webPreferences: {
-          offscreen: {
-            useSharedTexture: true
-          }
-        },
-        transparent: true,
-        frame: false,
-        width: 128,
-        height: 128
-      });
-
-      w.webContents.once('paint', async (e, dirtyRect) => {
-        try {
-          expect(e.texture).to.be.not.null();
-          const pixels = ExtractPixels(e.texture!.textureInfo);
-          const img = nativeImage.createFromBitmap(pixels, { width: dirtyRect.width, height: dirtyRect.height, scaleFactor: 1 });
-          expect(img.toBitmap().equals(targetImage.toBitmap())).to.equal(true);
-          done();
-        } catch (e) {
-          done(e);
-        }
-      });
-      w.loadFile(imagePath);
-    });
-  });
-
   describe('"transparent" option', () => {
     afterEach(closeAllWindows);
Repository: huggingface/transformers
Pull request: DOC: Fix typo in argument name: pseudoquant

# What does this PR do?

The correct argument name is `pseudoquantization`. Since there is no error on passing wrong argument names (which is arguably an anti-pattern), this is difficult for users to debug.

## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).

Changed files:
filename: docs/source/en/quantization/fp_quant.md
patch: @@ -40,7 +40,7 @@ You can choose between MXFP4 and NVFP4 with `FPQuantConfig(forward_dtype="mxfp4"
 
 A **Blackwell-generation GPU is required** to run the kernels. Runtime support for FP-Quant is implemented through the [QuTLASS](https://github.com/IST-DASLab/qutlass) library and a lightweight PyTorch interface lib [`fp_quant`](https://github.com/IST-DASLab/FP-Quant/tree/master/inference_lib). We recommend installing the former **from source** and the latter with  `pip install fp_quant`.
 
-Users **without a Blackwell-generation GPU** , can use the method with `quantization_config=FPQuantConfig(pseudoquant=True)` without having to install [QuTLASS](https://github.com/IST-DASLab/qutlass). This would provide no speedups but would fully emulate the effect of quantization.
+Users **without a Blackwell-generation GPU** , can use the method with `quantization_config=FPQuantConfig(pseudoquantization=True)` without having to install [QuTLASS](https://github.com/IST-DASLab/qutlass). This would provide no speedups but would fully emulate the effect of quantization.
 
 > [!TIP]
 > Find models pre-quantized with FP-Quant in the official ISTA-DASLab [collection](https://huggingface.co/collections/ISTA-DASLab/fp-quant-6877c186103a21d3a02568ee).
Repository: denoland/deno
Pull request: fix(watch): reduce graceful shutdown timeout from 5s to 500ms

## Summary

- Reduces `GRACEFUL_SHUTDOWN_TIMEOUT` from 5 seconds to 500ms

The 5-second grace period introduced in #32564 causes frustrating reload delays during development when a SIGTERM handler is registered (e.g. for production graceful DB shutdown). 500ms is enough time for most cleanup tasks (closing connections, flushing logs) while keeping the dev reload loop snappy.

## Test plan

- [x] Existing watcher tests pass (they check SIGTERM dispatch, not timeout duration)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Changed files:
filename: cli/util/file_watcher.rs
patch: @@ -39,7 +39,7 @@ use crate::util::fs::canonicalize_path;
 
 const CLEAR_SCREEN: &str = "\x1B[H\x1B[2J\x1B[3J";
 const DEBOUNCE_INTERVAL: Duration = Duration::from_millis(200);
-const GRACEFUL_SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5);
+const GRACEFUL_SHUTDOWN_TIMEOUT: Duration = Duration::from_millis(500);
 
 struct DebouncedReceiver {
   // The `recv()` call could be used in a tokio `select!` macro,
Repository: vercel/next.js
Pull request: Don't assign displayName to the internal Promises

Follow up to #85158.

We shouldn't assign a display name to internal one because now that wins over the one we actually want.

Changed files:
filename: packages/next/src/server/app-render/app-render.tsx
patch: @@ -3174,12 +3174,12 @@ function createAsyncApiPromisesInDev(
     // These are not used directly, but we chain other `params`/`searchParams` promises off of them.
     sharedParamsParent: stagedRendering.delayUntilStage(
       RenderStage.Runtime,
-      'params',
+      undefined,
       '<internal params>'
     ),
     sharedSearchParamsParent: stagedRendering.delayUntilStage(
       RenderStage.Runtime,
-      'searchParams',
+      undefined,
       '<internal searchParams>'
     ),
     connection: stagedRendering.delayUntilStage(
Repository: ollama/ollama
Pull request: Critical fix from llama.cpp JSON grammar to forbid un-escaped escape characters in JSON strings

JSON generation is broken, as models can insert control characters inside strings, which violates JSON.  For example, with the current JSON grammar, models could generate:

```
{ "key": "value
broken" }
```

This is incorrect, and if a linebreak is wanted in the middle of the string there, it should be:

```
{ "key": "value\nbroken" }
```

The former breaks at least the nodejs JSON parser, and likely many many others, since it's not compliant JSON.

This PR injects the grammar directly from llama.cpp upstream, which prohibits `\x00` through `\x1f` inside JSON strings, fixing the problem.

Changed files:
filename: llm/server.go
patch: @@ -606,7 +606,7 @@ array  ::=
 
 string ::=
   "\"" (
-    [^"\\] |
+    [^"\\\x7F\x00-\x1F] |
     "\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]) # escapes
   )* "\"" ws
Repository: electron/electron
Pull request: fix: compilation error when disabling extensions and pdf_viewer

Backport of #47964

See that PR for details.


Notes: <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/main/README.md#examples -->Fixed compilation error when disabling extensions and pdf_viewer


Changed files:
filename: shell/browser/plugins/plugin_utils.cc
patch: @@ -33,6 +33,7 @@ std::string PluginUtils::GetExtensionIdForMimeType(
 base::flat_map<std::string, std::string>
 PluginUtils::GetMimeTypeToExtensionIdMap(
     content::BrowserContext* browser_context) {
+  base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
 #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
   const auto& allowed_extension_ids = MimeTypesHandler::GetMIMETypeAllowlist();
   if (allowed_extension_ids.empty())
@@ -41,8 +42,6 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
   const extensions::ExtensionSet& enabled_extensions =
       extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions();
 
-  base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
-
   // Go through the white-listed extensions and try to use them to intercept
   // the URL request.
   for (const std::string& id : allowed_extension_ids) {

filename: shell/browser/printing/printing_utils.cc
patch: @@ -81,6 +81,7 @@ bool IsDeviceNameValid(const std::u16string& device_name) {
 
 namespace {
 
+#if BUILDFLAG(ENABLE_PDF_VIEWER)
 // Duplicated from chrome/browser/printing/print_view_manager_common.cc
 content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
   content::RenderFrameHost* full_page_plugin = nullptr;
@@ -99,6 +100,7 @@ content::RenderFrameHost* GetFullPagePlugin(content::WebContents* contents) {
 #endif  // BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
   return full_page_plugin;
 }
+#endif  // BUILDFLAG(ENABLE_PDF_VIEWER)
 
 }  // namespace
 
@@ -119,7 +121,7 @@ content::RenderFrameHost* GetRenderFrameHostToUse(
   if (pdf_rfh) {
     return pdf_rfh;
   }
-#endif  // BUILDFLAG(ENABLE_PDF)
+#endif  // BUILDFLAG(ENABLE_PDF_VIEWER)
   auto* focused_frame = contents->GetFocusedFrame();
   return (focused_frame && focused_frame->HasSelection())
              ? focused_frame
Repository: huggingface/transformers
Pull request: [kernels] change import time in KernelConfig

# What does this PR do?

Importing `kernels` when not installed was causing issues in the CI. Since we have a `kernels` folder `_is_package_availabe` assumes the package `kernels` is available when it's not. This PR simply fixes that by moving the import inside the kernel function that are only executed when we are sure `kernels` is installed

Changed files:
filename: src/transformers/utils/kernel_config.py
patch: @@ -12,12 +12,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from ..utils import PushToHubMixin, is_kernels_available, is_torch_available
+from ..utils import PushToHubMixin, is_torch_available
 
 
-if is_kernels_available():
-    from kernels import LayerRepository, Mode
-
 if is_torch_available():
     import torch
 
@@ -58,6 +55,8 @@ def infer_device(model):
 
 
 def add_to_mapping(layer_name, device, repo_name, mode, compatible_mapping):
+    from kernels import LayerRepository
+
     if device not in ["cuda", "rocm", "xpu"]:
         raise ValueError(f"Only cuda, rocm, and xpu devices supported, got: {device}")
     repo_layer_name = repo_name.split(":")[1]
@@ -82,6 +81,8 @@ def __init__(self, kernel_mapping={}):
         self.registered_layer_names = {}
 
     def update_kernel(self, repo_id, registered_name, layer_name, device, mode, revision=None):
+        from kernels import LayerRepository
+
         self.kernel_mapping[registered_name] = {
             device: {
                 mode: LayerRepository(
@@ -204,6 +205,8 @@ def create_compatible_mapping(self, model, compile=False):
         The device is inferred from the model's parameters if not provided.
         The Mode is inferred from the model's training state.
         """
+        from kernels import Mode
+
         compatible_mapping = {}
         for layer_name, kernel in self.kernel_mapping.items():
             # Infer Mode: use Mode.TRAINING if model is training, else use Mode.INFERENCE
Repository: ggml-org/llama.cpp
Pull request: CANN: Fix rename for get_env

In #18624, get_env in ggml-cann was renamed to get_env_as_lowercase to accurately reflect the function’s behavior and reduce the chance of misuse. However, the update missed renaming call sites in other files. This commit fixes that oversight.

I'm wondering why the CANN build CI failed to detect this issue.

Changed files:
filename: ggml/src/ggml-cann/aclnn_ops.cpp
patch: @@ -1963,7 +1963,7 @@ static void ggml_cann_mat_mul_fp(ggml_backend_cann_context & ctx, ggml_tensor *
     acl_tensor_ptr acl_weight_tensor;
 
     // Only check env once.
-    static bool weight_to_nz = parse_bool(get_env("GGML_CANN_WEIGHT_NZ").value_or("on"));
+    static bool weight_to_nz = parse_bool(get_env_as_lowercase("GGML_CANN_WEIGHT_NZ").value_or("on"));
     if (weight_to_nz && is_matmul_weight(weight)) {
         acl_weight_tensor = ggml_cann_create_tensor(weight, transpose_ne, transpose_nb, n_dims, ACL_FORMAT_FRACTAL_NZ);
     } else {

filename: ggml/src/ggml-cann/common.h
patch: @@ -103,7 +103,7 @@ const ggml_cann_device_info & ggml_cann_info();
 void    ggml_cann_set_device(int32_t device);
 int32_t ggml_cann_get_device();
 
-std::optional<std::string> get_env(const std::string & name);
+std::optional<std::string> get_env_as_lowercase(const std::string & name);
 bool                       parse_bool(const std::string & value);
 int                        parse_integer(const std::string & value);
Repository: huggingface/transformers
Pull request: Fix `run slow v2`: empty report when there is only one model

# What does this PR do?

Fix Run slow v2 (#41914):

when there is only one model specified (in particular, new model addition PR), the `setup` job's step in `.github/workflows/self-scheduled.yml`:

> echo "slice_ids=$(python3 -c 'd = list(range(${{ env.NUM_SLICES }})); print(d)')" >> $GITHUB_OUTPUT

will still generate a list `[0,1]` (because `NUM_SLICES: 2`) and the `run_models_gpu` will have a matrix `slice_id: [0, 1]` but one of it would get an empty list of models to run.

The workflow still runs without problem, but this causes `${{ needs.model-ci.outputs.report }}` in `.github/workflows/self-comment-ci.yml` being empty , see [this run](https://github.com/huggingface/transformers/actions/runs/19057114226/job/54430404760).
We got `Annotations 3 errors` if we click any job which shows

> Error when evaluating 'strategy' for job 'run_models_gpu'. huggingface/transformers/.github/workflows/model_jobs.yml@f6837a4cf5b173c38c992531685a4a9c2fe43259 (Line: 54, Col: 18): Matrix vector 'folders' does not contain any values


This PR fixes this issue by using the actual length of `folder_slices` instead.

Changed files:
filename: .github/workflows/self-scheduled.yml
patch: @@ -102,8 +102,10 @@ jobs:
         working-directory: /transformers/tests
         run: |
           if [ "${{ inputs.job }}" = "run_models_gpu" ]; then
-            echo "folder_slices=$(python3 ../utils/split_model_tests.py --subdirs '${{ inputs.subdirs }}' --num_splits ${{ env.NUM_SLICES }})" >> $GITHUB_OUTPUT
-            echo "slice_ids=$(python3 -c 'd = list(range(${{ env.NUM_SLICES }})); print(d)')" >> $GITHUB_OUTPUT
+            python3 ../utils/split_model_tests.py --subdirs '${{ inputs.subdirs }}' --num_splits ${{ env.NUM_SLICES }} > folder_slices.txt
+            echo "folder_slices=$(cat folder_slices.txt)" >> $GITHUB_OUTPUT
+            python3 -c "import ast; folder_slices = ast.literal_eval(open('folder_slices.txt').read()); open('slice_ids.txt', 'w').write(str(list(range(len(folder_slices)))))"
+            echo "slice_ids=$(cat slice_ids.txt)" >> $GITHUB_OUTPUT
           elif [ "${{ inputs.job }}" = "run_trainer_and_fsdp_gpu" ]; then
             echo "folder_slices=[['trainer'], ['fsdp']]" >> $GITHUB_OUTPUT
             echo "slice_ids=[0, 1]" >> $GITHUB_OUTPUT

filename: utils/split_model_tests.py
patch: @@ -81,6 +81,8 @@
     for idx in range(args.num_splits):
         start = end
         end = start + num_jobs_per_splits + (1 if idx < num_jobs % args.num_splits else 0)
-        model_splits.append(d[start:end])
+        # Only add the slice if it is not an empty list
+        if len(d[start:end]) > 0:
+            model_splits.append(d[start:end])
 
     print(model_splits)
Repository: nodejs/node
Pull request: build: update minimum Xcode version to 16.4

Refs: https://github.com/nodejs/build/issues/4083
Closes: https://github.com/nodejs/node/issues/58069


Changed files:
filename: BUILDING.md
patch: @@ -157,7 +157,7 @@ Depending on the host platform, the selection of toolchains may vary.
 | ---------------- | -------------------------------------------------------------- |
 | Linux            | GCC >= 12.2 or Clang >= 19.1                                   |
 | Windows          | Visual Studio >= 2022 with the Windows 10 SDK on a 64-bit host |
-| macOS            | Xcode >= 16.3 (Apple LLVM >= 19)                               |
+| macOS            | Xcode >= 16.4 (Apple LLVM >= 19)                               |
 
 ### Official binary platforms and toolchains
 
@@ -249,7 +249,7 @@ FreeBSD and OpenBSD users may also need to install `libexecinfo`.
 
 #### macOS prerequisites
 
-* Xcode Command Line Tools >= 16.3 for macOS
+* Xcode Command Line Tools >= 16.4 for macOS
 * [A supported version of Python][Python versions]
   * For test coverage, your Python installation must include pip.
Repository: nodejs/node
Pull request: doc: update macOS version used to build releases

Refs: https://github.com/nodejs/build/issues/4083


Changed files:
filename: BUILDING.md
patch: @@ -166,8 +166,8 @@ Binaries at <https://nodejs.org/download/release/> are produced on:
 | Binary package          | Platform and Toolchain                                        |
 | ----------------------- | ------------------------------------------------------------- |
 | aix-ppc64               | AIX 7.2 TL04 on PPC64BE with GCC 12[^5]                       |
-| darwin-x64              | macOS 13, Xcode 16 with -mmacosx-version-min=13.5             |
-| darwin-arm64 (and .pkg) | macOS 13 (arm64), Xcode 16 with -mmacosx-version-min=13.5     |
+| darwin-x64              | macOS 15, Xcode 16 with -mmacosx-version-min=13.5             |
+| darwin-arm64 (and .pkg) | macOS 15 (arm64), Xcode 16 with -mmacosx-version-min=13.5     |
 | linux-arm64             | RHEL 8 with Clang 19.1 and gcc-toolset-14-libatomic-devel[^6] |
 | linux-ppc64le           | RHEL 8 with Clang 19.1 and gcc-toolset-14-libatomic-devel[^6] |
 | linux-s390x             | RHEL 8 with Clang 19.1 and gcc-toolset-14-libatomic-devel[^6] |
Repository: ollama/ollama
Pull request: Security fix: examples/langchain-python-rag-privategpt/requirements.txt to reduce vulnerabilities

The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-NUMPY-2321964
- https://snyk.io/vuln/SNYK-PYTHON-NUMPY-2321966
- https://snyk.io/vuln/SNYK-PYTHON-NUMPY-2321970

@[snyk-bot](https://github.com/ollama/ollama/commits?author=snyk-bot)
snyk-bot committed 3 days ago

Changed files:
filename: examples/langchain-python-rag-privategpt/requirements.txt
patch: @@ -11,4 +11,5 @@ tabulate==0.9.0
 pandoc==2.3
 pypandoc==1.11
 tqdm==4.66.1
-sentence_transformers==2.2.2
\ No newline at end of file
+sentence_transformers==2.2.2
+numpy>=1.22.2 # not directly required, pinned by Snyk to avoid a vulnerability
\ No newline at end of file
Repository: denoland/deno
Pull request: fix(ext/node): return pid from spawnSync

## Summary
- Returns `pid` from `op_spawn_sync` so `child_process.spawnSync()` results include the `pid` field as Node.js expects
- Factored out from #32810

## Test plan
- [x] `./x test-node child_process` passes (new `spawnSyncReturnsPid` test)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Changed files:
filename: ext/node/polyfills/internal/child_process.ts
patch: @@ -1728,6 +1728,8 @@ export function spawnSync(
       stderr = stderr && stderr.toString(encoding);
     }
 
+    // deno-lint-ignore no-explicit-any
+    result.pid = (output as any)._pid;
     result.status = status;
     result.signal = output.signal;
     result.stdout = stdout;

filename: ext/process/40_process.js
patch: @@ -17,6 +17,7 @@ const {
   ArrayPrototypeMap,
   ArrayPrototypeSlice,
   TypeError,
+  ObjectDefineProperty,
   ObjectEntries,
   SafeArrayIterator,
   String,
@@ -499,7 +500,7 @@ function spawnSyncInner(command, {
     input,
     argv0,
   });
-  return {
+  const output = {
     success: result.status.success,
     code: result.status.code,
     signal: result.status.signal,
@@ -516,6 +517,13 @@ function spawnSyncInner(command, {
       return result.stderr;
     },
   };
+  // Internal field used by node:child_process, hidden from Deno public API.
+  ObjectDefineProperty(output, "_pid", {
+    __proto__: null,
+    value: result.pid,
+    enumerable: false,
+  });
+  return output;
 }
 
 class Command {

filename: ext/process/lib.rs
patch: @@ -396,6 +396,7 @@ impl TryFrom<ExitStatus> for ChildStatus {
 
 #[derive(ToV8)]
 pub struct SpawnOutput {
+  pid: u32,
   status: ChildStatus,
   stdout: Option<Uint8Array>,
   stderr: Option<Uint8Array>,
@@ -1125,6 +1126,10 @@ fn op_spawn_sync(
     command: command.get_program().to_string_lossy().into_owned(),
     error: Box::new(e.into()),
   })?;
+  #[cfg(unix)]
+  let pid = child.id();
+  #[cfg(windows)]
+  let pid = child.id().expect("Process ID should be set.");
   if let Some(input) = input {
     let mut stdin = child.stdin.take().ok_or_else(|| {
       ProcessError::Io(std::io::Error::other("stdin is not available"))
@@ -1140,6 +1145,7 @@ fn op_spawn_sync(
         error: Box::new(e.into()),
       })?;
   Ok(SpawnOutput {
+    pid,
     status: output.status.try_into()?,
     stdout: if stdout {
       Some(output.stdout.into())

filename: tests/unit_node/child_process_test.ts
patch: @@ -1358,3 +1358,10 @@ Deno.test(function spawnSyncShellMetacharactersEscaped() {
   assertEquals(ret.status, 0);
   assertEquals(ret.stdout.trim(), "a&b|c<d>e");
 });
+
+Deno.test(function spawnSyncReturnsPid() {
+  const ret = spawnSync(Deno.execPath(), ["eval", "console.log('hi')"]);
+  assertEquals(ret.status, 0);
+  assertEquals(typeof ret.pid, "number");
+  assert(ret.pid > 0);
+});