Repository: sveltejs/kit (js)

Issue:
Builds hang on kit 1.0.13
### Describe the bug

Builds hang and never complete on 1.0.13, everything is fine on 1.012, sound like it was introduced by #8429.


### Reproduction

Working on a simple reproduction as it seems to be related to some specif usage. This happens before triggering the adaptaters. hooks.server.ts seems to be loaded on the build process, and it hangs there.

### Logs

```Shell
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/rentals/_error.svelte.js                                            0.39 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/_error.svelte.js                       0.39 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/_page.svelte.js                                                     0.40 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/settings/_error.svelte.js              0.40 kB
.svelte-kit/output/server/entries/pages/db/_page.svelte.js                                                                               0.43 kB
.svelte-kit/output/server/chunks/XMark.js                                                                                                0.49 kB
.svelte-kit/output/server/chunks/Plus.js                                                                                                 0.49 kB
.svelte-kit/output/server/entries/pages/auth/login/_page.svelte.js                                                                       0.54 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/_layout.server.ts.js                   0.59 kB
.svelte-kit/output/server/chunks/stores.js                                                                                               0.60 kB
.svelte-kit/output/server/chunks/ArchivedBox.js                                                                                          0.73 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/_layout.server.ts.js                                                0.79 kB
.svelte-kit/output/server/chunks/ArchivedBoxXMark.js                                                                                     0.80 kB
.svelte-kit/output/server/chunks/zod.server.js                                                                                           0.83 kB
.svelte-kit/output/server/entries/pages/auth/login/_page.server.ts.js                                                                    0.94 kB
.svelte-kit/output/server/chunks/Dropdown.js                                                                                             1.15 kB
.svelte-kit/output/server/chunks/index2.js                                                                                               1.32 kB
.svelte-kit/output/server/chunks/Label.js                                                                                                1.37 kB
.svelte-kit/output/server/chunks/Logo.js                                                                                                 1.45 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/rentals/(rentals)/_page.server.ts.js                                1.46 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/(properties)/_page.server.ts.js                          1.47 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/settings/archive/_page.svelte.js       1.64 kB
.svelte-kit/output/server/chunks/countryName.js                                                                                          1.66 kB
.svelte-kit/output/server/chunks/index.js                                                                                                1.79 kB
.svelte-kit/output/server/entries/pages/test/_page.svelte.js                                                                             1.85 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/settings/archive/_page.server.ts.js    1.96 kB
.svelte-kit/output/server/chunks/session.server.js                                                                                       2.20 kB
.svelte-kit/output/server/chunks/property.lessor.server.js                                                                               2.30 kB
.svelte-kit/output/server/chunks/rentals.lessor.server.js                                                                                2.38 kB
.svelte-kit/output/server/chunks/hooks.server.js                                                                                         2.86 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/create/_page.server.ts.js                                3.28 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/_layout.svelte.js                      3.38 kB
.svelte-kit/output/server/chunks/index3.js                                                                                               3.78 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/settings/(update)/_page.server.ts.js   4.15 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/_layout.svelte.js                                                   4.68 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/settings/(update)/_page.svelte.js      5.61 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/settings/_layout.svelte.js             5.79 kB
.svelte-kit/output/server/chunks/server-internal.js                                                                                      6.01 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/create/_page.svelte.js                                   6.21 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/(properties)/_page.svelte.js                             6.69 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/rentals/(rentals)/_page.svelte.js                                   6.92 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/properties/_propertyId_uuid_/(overview)/_page.svelte.js             7.43 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/rentals/create/_page.server.ts.js                                   9.55 kB
.svelte-kit/output/server/entries/pages/_layout.svelte.js                                                                               11.88 kB
.svelte-kit/output/server/chunks/ErrorLayout.js                                                                                         16.19 kB
.svelte-kit/output/server/entries/pages/(app)/lessor/_lessorId_uuid_/rentals/create/_page.svelte.js                                     24.70 kB
.svelte-kit/output/server/index.js                                                                                                      76.22 kB
Server hooks loaded
```


### System Info

```Shell
System:
    OS: macOS 13.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 901.34 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
  Browsers:
    Chrome: 108.0.5359.124
    Firefox: 108.0.1
    Safari: 16.2
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0 => 1.0.0
    @sveltejs/adapter-netlify: ^1.0.1 => 1.0.1
    @sveltejs/adapter-node: ^1.1.1 => 1.1.1
    @sveltejs/adapter-vercel: ^1.0.2 => 1.0.2
    @sveltejs/kit: 1.0.13 => 1.0.13
    svelte: ^3.55.1 => 3.55.1
    vite: ^4.0.4 => 4.0.4
```


### Severity

blocking an upgrade

### Additional Information

using 1.0.12 fixes the issue

Pull request:
always exit postbuild process
hopefully fixes #8512

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [x] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.

### Tests
- [ ] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check`

### Changesets
- [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`.


Patch:
diff --git a/.changeset/blue-kings-beg.md b/.changeset/blue-kings-beg.md
new file mode 100644
index 000000000..eb938ad64
--- /dev/null
+++ b/.changeset/blue-kings-beg.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+fix: exit postbuild step with code 0
diff --git a/packages/kit/src/core/postbuild/index.js b/packages/kit/src/core/postbuild/index.js
index efce39141..d62bcdae9 100644
--- a/packages/kit/src/core/postbuild/index.js
+++ b/packages/kit/src/core/postbuild/index.js
@@ -102,3 +102,5 @@ writeFileSync(
 		value instanceof Map ? Array.from(value.entries()) : value
 	)
 );
+
+process.exit(0);


Test patch:
diff --git a/packages/kit/test/prerendering/basics/src/hooks.server.js b/packages/kit/test/prerendering/basics/src/hooks.server.js
index 6addcaac1..3c0f3c1df 100644
--- a/packages/kit/test/prerendering/basics/src/hooks.server.js
+++ b/packages/kit/test/prerendering/basics/src/hooks.server.js
@@ -16,3 +16,8 @@ export const handle = async ({ event, resolve }) => {
 		filterSerializedResponseHeaders: (name) => name === 'content-type'
 	});
 };
+
+// this code is here to make sure that we kill the process
+setInterval(() => {
+	console.log('process is still alive');
+}, 5000);