Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[Backport] Conditionally set CREATE_BREAKAWAY_FROM_JOB when job objec…
Browse files Browse the repository at this point in the history
…ts are used.

Backported so that we can launch our Windows bots from the Windows Task
Scheduler. Original commit message:

  This bit of code was added in 2010 by commit 66ae36f ("Restricting
  lifetime of python sync server on Windows via a JobObject"). The
  rationale at the time was that running a test case under a debugger
  would associate all new processes with the debugger's job object.

  Since 2010, Windows 8 and others have been releases, all of which
  support nested jobs and do not require processes to be created with
  the CREATE_BREAKAWAY_FROM_JOB. Not only that, but unconditionally
  setting that flag prevents browser tests from the Windows Task
  Scheduler at least on Windows 8 and later: the Task Scheduler creates
  a job object to launch the test(s), and calling CreateProcess() with
  that flag resulted in an access denied error (error number 5). Not
  setting it allows children processes to be created and attached to new
  job objects in addition to the Task Scheduler one.

  TEST=interactive_ui_tests, content_browsertests from the Windows Task
  Scheduler (set the task to only run when the user is logged in,
  otherwise the processes are launched from session 0)
  [email protected],[email protected],[email protected],[email protected]

  Review URL: https://codereview.chromium.org/1546313002

BUG=XWALK-5142
  • Loading branch information
raphael.kubo.da.costa authored and Olli Raula committed Feb 4, 2016
1 parent e44d4d1 commit df74102
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions base/process/launch_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ Process LaunchProcess(const string16& cmdline,

// If this code is run under a debugger, the launched process is
// automatically associated with a job object created by the debugger.
// The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this.
flags |= CREATE_BREAKAWAY_FROM_JOB;
// The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this on Windows
// releases that do not support nested jobs.
if (win::GetVersion() < win::VERSION_WIN8)
flags |= CREATE_BREAKAWAY_FROM_JOB;
}

if (options.force_breakaway_from_job_)
Expand Down

0 comments on commit df74102

Please sign in to comment.