Bug 1598511 - don't die if Subprocess can't chdir to workdir on OpenBSD r=kmag
authorLandry Breuil <landry@openbsd.org>
Wed, 18 Dec 2019 14:43:49 +0000
changeset 507537 6b1e007558d205fc3db537859a3915e097954b3f
parent 507536 3030c5f4eb64af55e9546dcc023fb98e321fb215
child 507538 8f7c8adba97495ee84ac52e7784e54c7c9af09d3
push id36930
push userncsoregi@mozilla.com
push dateWed, 18 Dec 2019 21:12:21 +0000
treeherdermozilla-central@f870bccd07ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1598511
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1598511 - don't die if Subprocess can't chdir to workdir on OpenBSD r=kmag As much as i'd prefer knowing why the failure to chdir() should be an error and not only a warning, let's get this in.. Differential Revision: https://phabricator.services.mozilla.com/D54719
toolkit/modules/subprocess/subprocess_worker_unix.js
--- a/toolkit/modules/subprocess/subprocess_worker_unix.js
+++ b/toolkit/modules/subprocess/subprocess_worker_unix.js
@@ -1,15 +1,16 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
+/* globals OS */
 /* exported Process */
 
 /* import-globals-from subprocess_shared.js */
 /* import-globals-from subprocess_shared_unix.js */
 /* import-globals-from subprocess_worker_common.js */
 importScripts(
   "resource://gre/modules/subprocess/subprocess_shared.js",
   "resource://gre/modules/subprocess/subprocess_shared_unix.js",
@@ -393,19 +394,21 @@ class Process extends BaseProcess {
 
     let cwd;
     try {
       if (options.workdir) {
         cwd = ctypes.char.array(LIBC.PATH_MAX)();
         libc.getcwd(cwd, cwd.length);
 
         if (libc.chdir(options.workdir) < 0) {
-          throw new Error(
-            `Unable to change working directory to ${options.workdir}`
-          );
+          if (OS.Constants.Sys.Name !== "OpenBSD") {
+            throw new Error(
+              `Unable to change working directory to ${options.workdir}`
+            );
+          }
         }
       }
 
       libc.posix_spawn_file_actions_init(actionsp);
       for (let [i, fd] of fds.entries()) {
         libc.posix_spawn_file_actions_adddup2(actionsp, fd, i);
       }