@@ -225,6 +225,7 @@ in rec {
225225 echo ' '
226226 echo '===================== '${ pkgs . lib . escapeShellArg title } ' ====================='
227227 '' ;
228+ completeHack = "rebuild-complete-hack-bnlzMmdjbXB5emozNWFndGx1bnd5dnh5" ;
228229 in ''
229230 ${ pkgs . xvfb-run } /bin/xvfb-run \
230231 --server-args="-screen 0 1920x1080x24 +extension GLX +extension RENDER -ac -noreset" \
@@ -318,17 +319,50 @@ in rec {
318319
319320 ${ mkSection "Running @electron/rebuild" }
320321 # XXX: we need to run the command with the Node.js env set correcty, `npm.cmd` does that:
321- export electron_rebuild_bin="$(winepath -w "$(readlink -f node_modules/.bin/electron-rebuild)")"
322+ lx_electron_rebuild_bin="$(readlink -f node_modules/.bin/electron-rebuild)"
323+ export electron_rebuild_bin="$(winepath -w "$lx_electron_rebuild_bin")"
324+
325+ # XXX: for some reason the build hangs (only on Cicero!) after outputting "Rebuild Complete", so let's hack around that:
326+ sed -r '/Rebuild Complete/a require("fs").writeFileSync("${ completeHack } ", "");' -i "$lx_electron_rebuild_bin"
327+
328+ # XXX: re-enable this if you need to simulate Cicero hanging locally:
329+ # sed -r 's/rebuildSpinner.succeed\(\);/setTimeout(function(){rebuildSpinner.succeed();},10000);/g' -i "$lx_electron_rebuild_bin"
330+
331+ (
332+ while true ; do
333+ if [ -e ${ completeHack } ] ; then
334+ echo "Found ${ completeHack } , killing node.exe among:"
335+
336+ ps aux | cat
337+
338+ pkill -9 node.exe || true
339+ break
340+ else
341+ sleep 2
342+ fi
343+ done
344+ ) &
345+ wine_killer_pid=$!
346+
322347 cp ${ pkgs . writeText "package.json" ( builtins . toJSON (
323348 pkgs . lib . recursiveUpdate originalPackageJson {
324349 scripts = {
325350 "build:electron:windows" = "node.exe %electron_rebuild_bin% -f -w usb" ;
326351 } ;
327352 }
328353 ) ) } package.json
329- wine npm.cmd run build:electron:windows
330-
331- # XXX: We’re running in a separate namespace, so this is fine. Otherwise, builds on Cicero hang.
354+ wine npm.cmd run build:electron:windows || {
355+ real_ec=$?
356+ if [ -e ${ completeHack } ] ; then
357+ echo "Wine would return $real_ec, but ${ completeHack } exists"
358+ return 0
359+ else
360+ return $real_ec
361+ fi
362+ }
363+ kill $wine_killer_pid || true
364+
365+ # XXX: We’re running in a separate namespace, so this is fine.
332366 while pgrep wine >/dev/null ; do
333367 ${ mkSection "Wine is still running in the background, will try to kill it" }
334368 echo 'All remaining processes:'
0 commit comments