运行 作为计划任务 Powershell 脚本时 Chromium 源下载错误

Chromium source download errors when running as Scheduled Task Powershell script

我正在尝试使用 Chromium Docs 中的步骤为 Chromium 源代码和相关 v8 代码编写下载和构建步骤的脚本。

Powershell 运行 命令:

.\dl-chromium-src.ps1 -c stable -d E:\chromium-downloads -r E:\scripts

CMD 运行 命令:

powershell -NoProfile -ExecutionPolicy Bypass -File E:\scripts\dl-chromium-src.ps1 -c stable -d E:\chromium-downloads -r E:\scripts

当脚本为 运行 时,我在 fetch 调用 (Line 91) 期间不断收到错误消息。我认为这与制作步骤有关,但我不确定。

错误信息:

IOError: [Errno 2] No such file or directory: 'toolchain\win_x86\x86_64-nacl\include\c++\4.4.3\ext\pb_ds\detail\binomial_heap_\constructors_destructor_fn_imps.hpp'

当从 powershell window 手动 运行ning fetch --no-history chromium 时,我没有收到此错误。当脚本从命令行(例如通过计划任务)为 运行 时,我只会收到错误消息。

我假设它与配置文件有关,所以我尝试 运行 在没有 -NoProfile 的情况下设置脚本,但这没有帮助。我还从 Powershell 命令行和 Powershell 脚本中检查了环境变量,它们是相同的。我在下面包含了代码和更详细的堆栈跟踪。

代码

脚本参数

+--------------------+-------+-------------------+
|     Parameter      | Alias |    Valid Input    |
+--------------------+-------+-------------------+
| channel            | -c    | "beta" | "stable" |
| downloadsDirectory | -d    | <String>          |
| runningDirectory   | -r    | <String>          |
+--------------------+-------+-------------------+

此问题与 Windows 长路径名限制有关。我更新了 OS 和 git 的路径长度最大值,但上面的这些堆栈跟踪来自 python 脚本。我无法弄清楚如何为 python 修复它,所以我最终缩短了我的路径名,然后脚本工作了。